बिजनेस मार्केटिंग का लो कॉस्ट फंडा , अपने मोबाइल से ऑटो sms भेजकर मार्केटिंग करे विजिट करे http://autotextsms.com/ बिजनेस मार्केटिंग का लो कॉस्ट फंडा http://autotextsms.com/

Search This Blog

Translate

Showing posts with label write a program to count the number of times an item is present in a linked list. Show all posts
Showing posts with label write a program to count the number of times an item is present in a linked list. Show all posts

count no of occurrences in linked list using recursion

write a program to count the number of times an item is present in a linked list.
count nodes in linked list c++
algorithm to count the number of nodes in linked list
how to count the number of nodes in a linked list java
linked list count java
count the number of nodes in a circular linked list
c program to find the occurrence of a digit in a number
wap to reverse the elements in a single linked list.

Program to count no of occurrences in linked list using recursion

 #include <stdio.h>
void occur(int [], int, int, int, int *);
 int main()
{ int size, key, count = 0;
int list[20]; int i;
 printf("Enter the size of the list: ");
scanf("%d", &size);111
 printf("Printing the list:\n");
for (i = 0; i < size; i++)
{ printf("\nenter the %d element\n",i+1);
 scanf("%d",&list[i]); 
 }
 for (i = 0; i < size; i++)
 {
 printf("%d ", list[i]);
}
 printf("\nEnter the key to find it's occurence: ");

scanf("%d", &key);
 occur(list, size, 0, key, &count);
printf("%d occurs for %d times.\n", key, count);
 return 0;
 }

void occur(int list[], int size, int index, int key, int *count)
 {
 if (size == index)
{
return;
 }
 if (list[index] == key) { *count += 1;
}
 occur(list, size, index + 1, key, count);
 }



  • write a program to count the number of times an item is present in a linked list.
  • count nodes in linked list c++
  • algorithm to count the number of nodes in linked list
  • how to count the number of nodes in a linked list java
  • linked list count java
  • count the number of nodes in a circular linked list
  • c program to find the occurrence of a digit in a number
  • wap to reverse the elements in a single linked list.



C Program example List