Breaking News
recent

Algorithm Analysis and Design Questions and Answers

Algorithm Analysis and Design

Question:- If each node in a tree has value greater than every value in its left sub tree and value less than every value in its right sub tree, the tree is known as
(A) complete tree                   
(B) full binary tree     
(C) binary search tree                        
(D) threaded tree Which of the following sorting 

Question:- procedure is the slowest?
(A) Quick sort              
(B) Heap sort              
(C) Shell sort              
(D) Bubble sort

Question:- which of the following shows the correct relationship among some of the more common computing times on algorithms
(A) O(log n) < O(n) < O( n* log n) < O(2n) < O(n2)
(B) O(n) < O(log n) < O( n* log n) < O(2n) < O(n2)
(C) O(n) < O(log n) < O( n* log n) < O(n2) < O(2n)
(D) O(log n) < O(n) < O( n* log n) < O(n2) < O(2n)

Question:-  The average time required to perform a successful sequential search for an element in an array A(1..n) is given by
(A) (n+1)/2                  
(B) n(n+1)/2                
(C) log n                      
(D) n2

Question:-  the time complexity of linear search algorithm over an array of n elements is
(A) O(log n)                 
(B) O(n)                       
(C)  O( n log n)            
(D) O(n2)

Question:-  the time taken by binary search algorithm to search a key in a sorted array of n elements is
(A) O(log n)                 
(B) O(n)                       
(C)  O( n log n)            
(D) O(n2)

Question:-  the time required to search an element in a linked list of length n is
(A) O(log n)                 
(B) O(n)                       
(C)  O( 1)                     
(D) O(n2)

Question:- the worst case time required to search a given element in sorted linked list of length n is
(A) O(1)                       
(B) O( log n)                
(C)  O(n)          
(D) O(n log n)

Question:-  consider a linked list of n elements which is pointed by an external pointer. What is the time taken to delete the element which is successor of the element pointed to by a given pointer?
(A) O(1)                       
(B) O( log n)                
(C)  O(n)          
(D) O(n log n)

Question:-  consider a linked list of n elements. What is the time taken to insert an element an after element pointed by some pointer?
(A) O(1)                       
(B) O( log n)                
(C)  O(n)          
(D) O(n log n)

Question:-  Let there be an array of length ‘N’, and the selection sort algorithm is used to sort it, how many times a swap function is called to complete the execution?
(a)  N log N times                                  
(b)  log N times
(c)  N2 times                                       
(d)  N-1 times       

Question:-  The Sorting method which is used for external sort is
(a)  Bubble sort                 
(b)  Quick sort                       
(c)  Merge sort        
(d)  Radix sort      


Question:-  In analysis of algorithm, approximate relationship between the size of the job and the amount of work required to do is expressed by using _________
(a)   Central tendency                                                      
(b) Differential equation
(c)   Order of execution                          
(d) Order of magnitude

Question:-  P, Q and R are pointer variables. The statements below are intended to swap the contents of the nodes pointed to by P and Q. rewrite it so that it will work as intended.
P = Q;    R = Q;   Q = R;
(a)   R=Q;  P=R;   Q=R;                          
(b)   R=P;   P=P;   Q=Q;
(c)   P=P;   P=Q;   R=Q;                         
(d)   R=P;   P=Q;   Q=R;

Question:-  Consider the usual algorithm for determining whether a sequence of parentheses is balanced. What is the maximum number of parentheses that will appear on the stack AT ANY ONE TIME when the algorithm analyzes: (()(())(()))
(a) 1                        
(b) 2                        
(c) 3                        
(d) 4               
Question:-  The Knapsack problem where the objective function is to minimize the profit is ______
(a)   Greedy                                          
(b)  Dynamic 0 / 1       
(c)  Back tracking                                  
(d)   Branch & Bound 0/1  


Question:-  Choose the correct answer for the following statements:
I.     The theory of NP–completeness provides a method of obtaining a polynomial time for NPalgorithms.
II.     All NP-complete problem are NP-Hard.

(a)   I is FALSE and II is TRUE
(b)   I is TRUE and II is FALSE
(c)   Both are TRUE
(d)   Both are FALSE

Question:-  For 0/1 KNAPSACK problem, the algorithm takes ________ amount of time for memory table, and ______time to determine the optimal load, for N objects and W as the capacity of KNAPSACK.
(a)   O(N+W), O(NW)      
(b)  O(NW), O(N+W)
(c)   O(N), O(NW)           
(d)  O(NW), O(N)                           

Question:-  What is the type of the algorithm used in solving the 8 Queens problem?
(a)Greedy
(b)Dynamic
(c)Branch and Bound
(d)Backtracking.

Question:-  Sorting is not possible by using which of the following methods?
(a)Insertion
(b)Selection
(c)Deletion
(d)Exchange

SID

SID

No comments:

Post a Comment

Powered by Blogger.