p=NULL;printf("\t\t\tmenu\n\n");printf("1.Add element\n2.Display elements\n3.Count of nodes\n4.Insert at begginning\n5.Insert at middle\n6.Insert at end\n7.Delete the element\n8.Search an element\n9.auxiliary search\n10.reverse list\n");do{printf("\nenter the choice\t"); scanf("%d",&choice);

switch(choice){case1:case6:printf("enter the element \t"); scanf("%d",&elmt); add(&p,elmt);break;case2: display(p);break;case3: count(p);break;case4:printf("\nenter the element to be inserted\t"); scanf("%d",&num); insertatbeg(&p,num);break;case5:printf("\nenter the position to insert\t"); scanf("%d",&pos); pos--;printf("enter the element to insert\t"); scanf("%d",&num); insertafter(&p,pos,num);break;case7:printf("\nenter the element to be deleted\t"); scanf("%d",&num); del(&p,num);break;case8:printf("\nenter the element to search\t"); scanf("%d",&num); search(&p,num);break;case9:printf("\nenter the element to search\t"); scanf("%d",&num); auxsearch(&p,num);break;case10:printf("\nafter reversing...\n"); revtraverse(&p); display(p);break;}printf("\ndo you want to continue? {y/n} \t"); wish=getche();}while(wish=='y' || wish =='Y'); getch();}

The array implementation of multisets is really only practical if the number of items in the universe, N=|U|, is not too large. If N is large, then it is impractical, or at least extremely inefficient, to use an array of N counters to represent the multiset. This is especially so if the number of elements in the multisets is significantly less than N. If we use a linked list of elements to represent a multiset S, the space required is proportional to the size of the multiset, |S|. When the size of the multiset is significantly less than the size of the universe, tex2html_wrap_inline67534, it is more efficient in terms of both time and space to use a linked list.

naimish

18Jul2009 11:06

Re: Linked Lists Implementation

Hey, haven't watched this article, I have also submitted an article on Linked List in C++ just now, please check if it's useful or not, This one is also good. Lets c if I can combine both one and make new simple and easier one ;)

vignesh1988i

22Sep2009 11:49

Re: Linked Lists Implementation

your implementation is correct , one small opinion :
As u have declared the structure globally , why are u passing the structure everytime for every function as a argument ..... since ur structure is global , you could have directly access it na.... so readability of your program increases.............