Searching in circular singly linked listSearching in circular singly linked list needs traversing across the list. The item which is to be searched in the list is matched with each node data of the list once and if the match found then the location of that item is returned otherwise -1 is returned. The algorithm and its implementation in C is given as follows. Algorithm
WRITE "EMPTY LIST" write i+1 [END OF LOOP] C FunctionOutput 1.Create 2.Search 3.Exit 4.Enter your choice?1 Enter the item 12 Node Inserted 1.Create 2.Search 3.Exit 4.Enter your choice?1 Enter the item 23 Node Inserted 1.Create 2.Search 3.Exit 4.Enter your choice?2 Enter item which you want to search? 12 item found at location 1
Next TopicDoubly Linked List
|