Linked List & Binary Tree ISC Computer Science 2025 Theory Specimen

(i) 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)

void findNode(Node str, int b){
    if(str == null)
        System.out.println(b + " NOT FOUND!");
    else if(str.n == b)
        System.out.println(b + " FOUND!");
    else
        findNode(str.link, b);
}

(ii) Answer the following questions from the diagram of Binary Tree given below:

(a) Name the root of the left subtree and its siblings.
B is the root of the left subtree. F is its sibling.

(b) State the size and depth of the right subtree.
The size of a tree is the total number of nodes. So, the size of the right subtree is 4.
The depth of a tree is the number of edges on the longest path from the root to the leaf. So, the depth of the right subtree is 2.

(c) Write the in-order traversal of the above tree structure.
EDBACFGH

Leave a Reply

Your email address will not be published. Required fields are marked *