Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- struct node
- {
- char data;
- int fre;
- struct node *next;
- };
- struct node *head=NULL,*temp,*s;
- void display()
- {
- temp=head;
- while(temp!=NULL)
- {
- cout<<temp->data<<" "<<temp->fre<<endl;
- temp=temp->next;
- }
- }
- int main()
- {
- int n,i;
- char alpha='a';
- for(i=1; i<=26; i++)
- {
- struct node *newnode;
- newnode=(struct node*) malloc (sizeof(struct node));
- newnode->data=alpha;
- newnode->fre=0;
- newnode->next=NULL;
- if(head==NULL)
- {
- head=newnode;
- s=head;
- }
- else
- {
- s->next=newnode;
- s=newnode;
- }
- alpha++;
- }
- display();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement