Question
A linked list is formed from the objects of the class ,
class Node
{
int number;
Node nextNode;
}
Write a method OR an algorithm to add a node at the end of existing the linked list .The method declaration is specified below:
void addnode(Node start,int num);
Share code with your friends
Share on whatsapp
Share on facebook
Share on twitter
Share on telegram
Code
void addnode(Node start,int num)
{
Node temp=new Node(start);
while(temp.nextNode!=null)
{
temp=temp.nextNode;
}
Node C=new Node();
C.number=num;
C.nextNode=null;
temp.nextNode=C;
}
Coding Store
Sale

ISC QUESTION PAPERS WITH SOLUTION(PROGRAMMING ONLY)
Sale
