• Tutorials
  • DSA
  • Data Science
  • Web Tech
  • Courses
May 27, 2022 |570 Views

Search an element in a Linked List (Iterative and Recursive)

  Share   Like
Description
Discussion

Write a function that searches a given key ‘x’ in a given singly linked list. The function should return true if x is present in linked list and false otherwise. 
 

  bool search(Node *head, int x)

For example, if the key to be searched is 15 and linked list is 14->21->11->30->10, then function should return false. If key to be searched is 14, then the function should return true.

Search an element in a Linked List (Iterative and Recursive): https://www.geeksforgeeks.org/search-an-element-in-a-linked-list-iterative-and-recursive/