Question
A linked list is formed from the objects of the class Node. The class structure of the Node is given below:
class Node
{
int n;
Node link;
}
Write an Algorithm OR a Method to search for a number from an existing linked list. The method declaration is as follows:
void FindNode( Node str, int b )
Share code with your friends
Share on whatsapp
Share on facebook
Share on twitter
Share on telegram
Code
void FindNode(Node str, int b)
{
Node temp=str;
while(temp!=null)
{
if (temp.n == b)
{
System.out.prinln(b+" is found ");
break;
}
temp=temp.link;
}
}
Coding Store
Sale

ISC QUESTION PAPERS WITH SOLUTION(PROGRAMMING ONLY)
Sale

ICSE QUESTION PAPER WITH SOLUTION(PROGRAMMING ONLY)
Sale

ISC QUESTION PAPERS WITH SOLUTION(PROGRAMMING ONLY)
Sale

ICSE QUESTION PAPER WITH SOLUTION(PROGRAMMING ONLY)
Sale

ISC QUESTION PAPERS WITH SOLUTION(PROGRAMMING ONLY)
Sale
