Data Structure


Q181.

The minimum number of interchanges needed to convert the array into a max-heap is 89, 19, 40, 17, 12, 10, 2, 5, 7, 11, 6, 9, 70
GateOverflow

Q182.

A data structure is required for storing a set of integers such that each of the following operations can be done in O(logn) time, where n is the number of elements in the set. 1. Delection of the smallest element. 2. Insertion of an element if it is not already present in the set. Which of the following data structures can be used for this purpose ?
GateOverflow

Q183.

Consider any array representation of an n element binary heap where the elements are stored from index 1 to index n of the array. For the element stored at index i of the array (i\leq n ) , the index of the parent is
GateOverflow

Q184.

Given the following input (4322, 1334, 1471, 9679, 1989, 6171, 6173, 4199) and the hash function x mod 10, which of the following statements are true? i) 9679, 1989, 4199 hash to the same value ii) 1471, 6171 has to the same value iii) All elements hash to the same value iv) Each element hashes to a different value
GateOverflow

Q185.

A hash table contains 10 buckets and uses linear probing to resolve collisions. The key values are integers and the hash function used is key % 10. If the values 43, 165, 62, 123, 142 are inserted in the table, in what location would the key value 142 be inserted?
GateOverflow

Q186.

Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list. Let n denote the number of nodes in each of the linked lists. Which one of the following choices is TRUE about the worst-case time complexity of SLLdel and DLLdel?
GateOverflow

Q187.

Consider the problem of reversing a singly linked list. To take an example, given the linked list below,the reversed linked list should look like Which one of the following statements is TRUE about the time complexity of algorithms that solve the above problem in O(1) space?
GateOverflow

Q188.

A doubly linked list is declared as: struct Node { int Value; struct Node *Fwd; struct Node *Bwd; };Where Fwd and Bwd represent forward and backward link to the adjacent elements of the list. Which of the following segment of code deletes the node pointed to by X from the doubly linked list, if it is assumed that X points to neither the first nor the last node of the list?
GateOverflow

Q189.

Consider the following ANSI C program:#include < stdio.h > #include < stdlib.h > struct Node{ int value; struct Node *next;}; int main( ) { struct Node *boxE, *head, *boxN; int index=0; boxE=head= (struct Node *) malloc(sizeof(struct Node)); head -> value = index; for (index =1; index < = 3; index++){ boxN = (struct Node *) malloc (sizeof(struct Node)); boxE -> next = boxN; boxN -> value = index; boxE = boxN; } for (index=0; index < = 3; index++) { printf("Value at index %d is %d\n", index, head -> value); head = head -> next; printf("Value at index %d is %d\n", index+1, head -> value); } } Which one of the following statements below is correct about the program?
GateOverflow

Q190.

What is the worst case time complexity of inserting n elements into an empty linked list, if the linked list needs to be maintained in sorted order?
GateOverflow