C Programs Tutorials | IT Developer
IT Developer

Java Programs - Solved 2023 Theory Paper ISC Computer Science



Share with a Friend

Solved 2023 Thory Paper ISC Computer Science

Class 12 - ISC Computer Science Solved Theory Papers

Linked List & Binary Tree Question - ISC 2023 Theory

(i) A linked list is formed from the objects of the class given below:

class Node{

    double sal;

    Node next;

}

 

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 ptr, double ss)

void addNode(Node ptr, double ss){

    if(ptr == null)

        ptr = new Node(ss);

    else if(ptr.next == null)

        ptr.next = new Node(ss);

    else

        ptr = ptr.next;

}

(ii) Answer the following questions from the diagram of a binary tree given below:

 

 

(a) Write the pre-order traversal of the above tree structure.
A→F→D→G→B→H→E

 

(b) Name the parent of the nodes D and B.
Parent of D is F.
Parent of B is A.