Professional Documents
Culture Documents
ISC Solved Linked List Algorithms PDF
ISC Solved Linked List Algorithms PDF
GFS
void deletenode (Node start)
ISC 2013
A linked list is formed from the objects of the class,
class Node
{
int item;
Node next;
}
Write an Algorithm OR a Method to count the number of nodes in the linked list.
The method declaration is given below:
int count(Node ptr_start)
GFS
Steps :
1- Start
2- Set temporary pointer to start node and counter to 0.
3- Repeat steps 4 and 5 until the pointer reaches null
4- Increment the counter
5- move temporary pointer to the next node
6- Return the counter value
7- End
ISC 2014
A linked list is formed from the objects of the class:
class Node
{
int number;
Node nextNode;
}
Write an Algorithm OR a Method to add a node at the end of an existing linked list.
The method declaration is as follows:
void addnode ( Node start, int num )
Steps :
1- Start
2- Set temporary pointer to start node
3- Repeat step 4 until it reaches null
4- move pointer to the next node
5- create new node, assign num to number and nextNode to null
6- Set temporary pointer to new node
7- End
ISC 2015
A linked list is formed from the objects of the class:
class Nodes
{
int num;
Nodes next;
}
Write an Algorithm OR a Method to print the sum of nodes that contains only odd integers of an
existing linked list.
The method declaration is as follows:
void NodesCount( Nodes starPtr )
Algorithm to print the sum of the nodes of odd integers in an existing linked list.
GFS
Steps :
1- Start
2- Set temporary pointer to start node and sum to 0.
3- Repeat steps 4 and 5 until the pointer reaches null.
4- if num is odd, add it to sum
5- Move pointer to the next node
6- Display sum.
7- End
ISC 2016
A linked list is formed from the objects of the class Node. The class structure of the Node is given
below:
class Node
{
String name;
Node next;
}
Write an Algorithm OR a Method to search for a given name in the linked list. The method of
declaration is given below:
boolean searchName(Node start, String v)
ALGORITHM:
Steps :
1- Start
2- Set temporary pointer to the start node
3- Repeat steps 4 until the pointer reaches null. Return false.
4- if name equals to v,
Return true.
Exit.
else
Move pointer to the next node
5- End
ISC 2017
A linked list is formed from the objects of the class Node. The class structure of the Node is given
below:
class Node
{
int num;
Node next;
}
Write an Algorithm OR a Method to count the nodes that contain only odd integers from an existing
linked list and returns the count. The method declaration is as follows:
int CountOdd( Node startPtr )
ALGORITHM:
Steps :
GFS
1- Start
2- Set temporary pointer to the start node and count to 0
3- Repeat step 4 until the pointer reaches null.
4- if num is odd
Increment counter
else
Move pointer to the next node
5- Return count
6- End
ISC 2018
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 )
ALGORITHM:
Steps :
1- Start
2- Set temporary pointer to the start node
3- Repeat steps 4 until the pointer reaches null. Display number not found.
4- if n equals to b,
Display number found.
Exit.
else
Move pointer to the next node
5- End