(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.
(c) State the level of nodes E and F when the root is at level 0.
Level of E is 3.
Level of F is 1.