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?
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?
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?
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?