# Data Structure and Algorithm Analysis Set 29

## Data Structure and Algorithm Analysis

### Questions 281 to 290

 281 This algorithm scans the list by swapping the entries whenever pair of adjacent keys are out of desired order. (a)  Insertion sort     (b)  Quick sort         (c)  Shell sort           (d)  Bubble sort       (e)  Radix sort. 282 At a given node of a simple graph, the number of loops are _________ (a)  More than one                                 (b)  Not more than one                           (c)  Zero (d)  Exactly two                                     (e)  Equal to the number of nodes of the graph. 283 In the linked list implementation of the stack, where does the push member function place the new entry on the linked list? (a)   At the head (b)   At the tail (c)   After all other entries those are greater than the new entry (d)   After all other entries those are smaller than the new entry (e)   At null node. 284 I have implemented the queue with a circular array, keeping track of first, last, and count (the number of items in the array). Suppose first is zero, and last is SIZE-1. What can you tell me about count?        (a)  count must be zero.                         (b)  count must be SIZE         (c)  count must be SIZE-2 (d)  count must be SIZE+1     (e)  count could be zero or SIZE, but no other values could occur. 285 Convert the following postfix expression to a fully-parenthesized infix expression: A B C - D E + * F * + (a)   (A + ((B - C) * (D + E) * F)) (b)   (A + (((B - C) * (D + E)) * F)) (c)   A + (((B - C) * (D + E)) * F) (d)   (A + ((B - C) * (D + E)) * F) (e)   A + ((B - C) * (D + E)) * F. 286 The linked list would be able to make use of a ------------- whose value is the address of the location which stores the node. (a)  integer              (b)  float                  (c)  char                  (d)  void                  (e)  pointer. 287 What kind of list is best to answer questions such as "What is the item at position n?" (a)   Lists implemented with an array (b)   Doubly-linked lists (c)   Singly-linked lists (d)   Doubly-linked or singly-linked lists are equally best (e)   Circular linked list implemented with priorities. 288 Consider the following pseudo code:        declare a stack of characters        while (there are more characters in the word to read ) {                 read a character        push the character on the stack }         while ( the stack is not empty)  {        pop a character off the stack       write the character to the screen  } What is written to the screen for the input "carpets"? (a)  serc                  (b)  steprac             (c)  carpets              (d)  ccaarrppeettss  (e)  stepr. 289 What is the value of the postfix expression 6 3 2 4 + - * (a)   Something between 5 and 15 (b)   Something between -5 and -15 (c)   Something between 5 and -5 (d)   Something between -15 and -100 (e)   Something between 15 and 100. 290 Suppose we have a circular array implementation of the queue type, with ten items in the queue stored at data through data. The current SIZE is 22. Where does the insert method place the new entry in the array? (a)  data              (b)  data            (c)  data             (d)  data            (e)  data.

Answers:

 281 Answer :  (d) Reason:  As in bubble sort always we swap the adjacent keys if they are not in desired order 282 Answer :  (c) Reason:  Because in simple graphs the loops are not allowed. 283 Answer :  (a) Reason:  Because in stack implemented using linked list, head always points to the top most node. 284 Answer :  (e) Reason:  Because first = 0 and rear = size-1 means either the stack is full or it was made to empty by after filling it to full. (Since this is a circular queue). 285 Answer :  (b) Reason:  As the fully parenthesized expression requires its sub parts to be in the parenthesis 286 Answer :  (e) Reason:  Because the pointer is used to hold the address of the next node in the list. 287 Answer :  (a) Reason:  Because index is required to locate a particular position, and in arrays this index can be used to locate an element. 288 Answer :  (b) Reason:  This nothing but pushing the characters on the stack and popping them from the stack and hence it will print the input in the reverse because of LIFO manner. 289 Answer :  (d) Reason:  Because the answer is -18. 290 Answer :  (c) Reason:  Because still the space is there in the queue and the next available location is 12th indexed one, therefore new element is inserted at that location.

<< PrevNext >>

#### 1 comment :

1. Very informative article.Thank you author for posting this kind of article .

http://www.wikitechy.com/view-article/explain-in-details-about-array-implementation-of-linked-list-in-c

Both are really good,.
Cheers,
Venkat