Linked List and Binary Tree ISC 2019 Theory

  1. 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 find and display the sum of even integers from an existing linked list.
    The method declaration is as follows:
    void sumEvenNode(Node str)

    void sumEvenNode(Node str){
        if(str == null)
            return 0;
        else if(str.num % 2 == 0)
            return str.num + sumEvenNode(str.next);
        else
            return 0 + sumEvenNode(str.next);
  2. Answer the following questions from the diagram of a binary tree given below:

Binary Tree ISC 2019

  1. Write the pre-order traversal of the above tree structure.
    A –> E –> G –> I –> C –> H –> B –> D –> F
  2. State the size of the tree.
    The size of the tree is 4.
  3. Name the siblings of the nodes E and G.
    Sibling of E is B.
    Sibling of G is C.

Leave a Reply