-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathll.cpp
More file actions
38 lines (35 loc) · 813 Bytes
/
ll.cpp
File metadata and controls
38 lines (35 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
struct node{
int data;
struct node *next;
};
struct node *head,*temp,*newnode,*zemp;
head = 0 ;
int k=1;
map<ll,ll> mp;
while(k){
newnode = (struct node*)new int[sizeof(struct node)];
cout<<"enter data : ";
cin>>newnode->data;
mp[newnode->data]++;
newnode->next=0;
if(head ==0){
head = newnode;
temp = newnode;
}
else{
temp->next = newnode;
temp = newnode;
}
cout<<"enter 1 to continue or 0 to break : ";
cin>>k;
}
cout<<"item"<<" "<<"occurance"<<endl;
for(auto val : mp){
cout<<val.first<<" "<<val.second<<endl;
}
return 0;
}