Ada Ds Gate Ques

64
1 [ADA & DS] ADA and ds GATE QUESTIONS 1991 1. The minimum number of comparisons required to sort 5 elements is _____

Transcript of Ada Ds Gate Ques

1 [ADA & DS]

ADA and ds GATE QUESTIONS 1991

1. The minimum number of comparisons required to sort 5 elements is _____

2 [ADA & DS]

1992

3 [ADA & DS]

4 [ADA & DS]

1993 1. Summation of O(n) over 1<=k<=n where O(n) stands for order n is:

(a) O(n) (b) O(n square) (c) O(n cube) (d) O(3 *n square) (e) O(1.5 * n square)

1994

5 [ADA & DS]

6 [ADA & DS]

1995 1. Merge sort uses

(a) Divide and conquer strategy (b) Backtracking approach

(c) Heuristic search (d) Greedy approach

4.Consider the following sequence of numbers 92, 37, 52, 12, 11, 25 Use bubblesort to arrange

the sequence in ascending order. Give the sequence at the end of each of the first five passes.

7 [ADA & DS]

1996

8 [ADA & DS]

9 [ADA & DS]

10 [ADA & DS]

11 [ADA & DS]

1997

12 [ADA & DS]

13 [ADA & DS]

14 [ADA & DS]

1998

15 [ADA & DS]

16 [ADA & DS]

1999

17 [ADA & DS]

18 [ADA & DS]

2000

19 [ADA & DS]

20 [ADA & DS]

21 [ADA & DS]

2001

(a) Insert the following keys one by one into a binary search tree in the order specified. 15, 32,

20, 9, 3, 25, 12, 1 Show the final binary search tree after the insertions.

22 [ADA & DS]

2002

6. Draw all binary trees having exactly three nodes labeled A, B and C on which

Preorder traversal gives the sequence C,B,A.

23 [ADA & DS]

24 [ADA & DS]

2003 4. Let A be a sequence of 8 distinct integers sorted in ascending order. How many distinct pairs

of sequences, B and C are there such that (i) each is sorted in ascending order, (ii) B has 5 and C

has 3 elements, and (iii) the result of merging B and C gives A?

(A) 2 (B) 30 (C) 56 (D) 256

25 [ADA & DS]

19. Suppose the numbers 7, 5, 1, 8, 3, 6, 0, 9, 4, 2 are inserted in that order into an initially empty

binary search tree. The binary search tree uses the usual ordering on natural numbers. What is the

in-order traversal sequence of the resultant tree?

(A) 7 5 1 0 3 2 4 6 8 9 (B) 0 2 4 3 1 6 5 9 8 7

(C) 0 1 2 3 4 5 6 7 8 9 (D) 9 8 6 4 2 3 0 1 5 7

26 [ADA & DS]

27 [ADA & DS]

28 [ADA & DS]

29 [ADA & DS]

30 [ADA & DS]

2004

31 [ADA & DS]

32 [ADA & DS]

33 [ADA & DS]

34 [ADA & DS]

35 [ADA & DS]

36 [ADA & DS]

2005

37 [ADA & DS]

38 [ADA & DS]

39 [ADA & DS]

40 [ADA & DS]

2006

41 [ADA & DS]

42 [ADA & DS]

43 [ADA & DS]

44 [ADA & DS]

45 [ADA & DS]

46 [ADA & DS]

2007

47 [ADA & DS]

48 [ADA & DS]

49 [ADA & DS]

50 [ADA & DS]

2008

51 [ADA & DS]

52 [ADA & DS]

53 [ADA & DS]

54 [ADA & DS]

2009

55 [ADA & DS]

56 [ADA & DS]

57 [ADA & DS]

58 [ADA & DS]

2010

59 [ADA & DS]

60 [ADA & DS]

61 [ADA & DS]

2011

62 [ADA & DS]

2012

63 [ADA & DS]

64 [ADA & DS]