1.
Which of the following permits removal at both ends of the list but insertion at only one end of the list?
2.
Which of the following trees have either 0 or 2 children?
3.
A data structure is needed for storing a set of integers such that each of the following operations can be done in (O(log N)) time, where N is the number of elements in the set:

  • Deletion of the smallest element

  • Insertion of an element if it is not already present in the set 


  •  

Which of the below listed data structures is most suitable for this purpose?
4.
Which of the following is an inorder traversal of a tree whose postorder traversal is 10, 9, 23, 22, 27, 25, 15, 50, 95, 60, 40, 29?
5.
In the following C code:
 
struct Celode {
    struct Celode * lchild;
    int element;
    struct Celode * rChild;
}

int DoSomething(struct Celode * ptr) {
    int value = 0;
    if (ptr != NULL) {
        if (ptr - > lChild != NULL)
            value = 1 + DoSomething(ptr - > lChild);
        if (ptr - > rChild != NULL)
            value = max(value, 1 + DoSomething(ptr - > rChild));
    }
    return (value);
}


If a pointer to the root of a non-empty tree is passed as an argument, the value returned by the DoSomething function is _______________________.
6.
Consider an array (A[1.. N]) which is used to implement two stacks. The two stacks grow from opposite ends of the array.
The variables (top1) and (top2) ((top1lt top2)) point to the location of the top element in each of the stacks.
If the space is to be used efficiently, which of these should be the condition for a full stack?
7.
Consider an empty hash table with the following properties:
Size: 7
Starting index: 0
Hash function: (3x + 4) mod 7
When the sequence 1, 3, 8, 10 is inserted into the table using closed hashing, what are the contents of the table?
8.
What is the maximum height of an AVL-tree with 7 nodes?
9.
A 3-ary max heap is like a binary max heap, but instead of two children, nodes have three children. A 3-ary heap can be represented by an array as follows
The root is stored in the first location, a[0]. Nodes in the next level, from left to right, are stored from a[1] to a[3].

The nodes of the second level of the tree, from left to right, are stored from a[4] onwards. An item x can be inserted into a 3-ary heap containing n items by placing x in the location a[n] and pushing it up the tree to satisfy the heap property.

Which of the following is a valid sequence of elements in an array representing a 3-ary max heap?
 
10.
Which of the following matrices has the majority of its elements as zero?