Data Structure
Q191.
In a doubly linked list the number of pointers affected for an insertion operation will beQ192.
Consider a singly linked list of the form where F is a pointer to the first element in the linked list and L is the pointer to the last element in the list. The time of which of the following operations depends on the length of the list?Q193.
Given two statementsInsertion of an element should be done at the last node of the circular listDeletion of an element should be done at the last node of the circular listQ194.
N items are stored in a sorted doubly linked list. For a delete operation, a pointer is provided to the record to be deleted. For a decrease-key operation, a pointer is provided to the record on which the operation is to be performed. An algorithm performs the following operations on the list in this order: \Theta(N) \; delete , O(logN) \; insert , O(logN) \; find , and \Theta(N) \; decrease-key. What is the time complexity of all these operations put together?Q195.
The following C function takes a simply-linked list as input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. typedef struct node { int value; struct node *next; } Node; Node *move_to_front(Node *head) { Node *p, *q; if ((head = = NULL: || (head->next = = NULL)) return head; q = NULL; p = head; while (p-> next !=NULL) { q=P; p=p->next; } _______________________________ return head; } Choose the correct alternative to replace the blank line.Q196.
Consider the C code fragment given below. typedef struct node { int data; node* next ; } node; void join (node* m, node* n) { node* p=n ; while (p->next ! =NULL){ p = p -> next ; } p-> next = m; } Assuming that m and n point to valid NULL- terminated linked lists, invocation of join willQ197.
An unordered list contains n distinct elements. The number of comparisons to find an element in this list that is neither maximum nor minimum isQ199.
An algorithm performs (log N)^{1/2} find operations, N insert operations, (log N)^{1/2} delete operations, and (log N)^{1/2} decrease-key operations on a set of data items with keys drawn from a linearly ordered set. For a delete operation, a pointer is provided to the record that must be deleted. For the decrease-key operation, a pointer is provided to the record that has its key decreased. Which one of the following data structures is the most suited for the algorithm to use, if the goal is to achieve the best total asymptotic complexity considering all the operations?Q200.
The following steps in a linked list p = getnode() info(p) = 10 next (p) = list list = p result in which type of operation?