You are on page 1of 6

C2-R3: DATA STRUCTURE THROUGH C LANGUAGE NOTE:

1. 2.

There are TWO PARTS in this Module/Paper. PART ONE contains FOUR questions and PART TWO contains SIX questions. PART ONE is to be answered in the TEAR-OFF ANSWER SHEET only, attached to the question paper, as per the instructions contained therein. PART ONE is NOT to be answered in the answer book.

Maximum time allotted for PART ONE is ONE HOUR. Answer book for PART TWO will be supplied at the table when the answer sheet for PART ONE is returned. Howe er, candidates, who complete PART ONE earlier than one hour, can collect the answer book for PART TWO immediately after handin! o er the answer sheet for PART ONE. TOTAL TIME: 3 HOURS TOTAL MARKS: 100 (PART ONE 40; PART TWO 60) PART ONE (An !"# $%% &'" ()" &*+n , 1E$.' ()" &*+n /"%+! 0*1" $ 2)%&*3%" .'+*." +4 $n !"# - C'++ " &'" 2+ & $33#+3#*$&" +n" $n5 "n&"# *n &'" 6&"$#-+447 $n !"# '""& $&&$.'"5 &+ &'" ()" &*+n 3$3"#8 4+%%+!*n0 *n &#).&*+n &'"#"*n(1 9 10,

3.

".". Ad#acency matrix for a di!raph is A$ %nit Matrix &$ 'ymmetric Matrix ($ Asymmetric matrix )$ none of the abo e ".*. Time complexity of insertion sort al!orithm in the best case is A$ +,n$ B) +,n lo!* n$ C) +,n*$ )$ none of the abo e ".-. The prefix expression for the infix expression a . , b / c $ /e 0 f is A$ /. a / bc 1 ef &$ 0/ . / abc ef ($ 0 / . a / bcef )$ none of the abo e ".2. 3n linked list representation, a node contains at least A$ node address field, data field &$ node number, data field ($ next address field, information field )$ none of the abo e C2-R3 P$0" 1 +4 : ;$n)$#<8 200:

".4. 5umber of nods in a complete binary tree of depth k is A) *k &$ *k C) *k0" )$ none of the abo e ".6. The smallest number of keys that will force a &0Tree of order - to ha e a hei!ht - is7 A$ "* &$ "8 ($ 9 )$ none of the abo e ".9. :i en two sorted lists of si;e <m= and <n= respecti ely, the number of comparisons needed in the worst case by the mer!e sort will be7 A$ m.n &$ max,m,n$ ($ min,m.n$ )$ m/n1" ".> Any strin! of bits of len!th n represents a unique non0ne!ati e inte!er between A) 8 and *n0" 0" B) 8 and *n0" C) " and *n0" )$ none of the abo e

1.9 ?hich of the followin! expressions accesses the ,i,#$th entry of a m n matrix stored in a
A$ &$ ($ )$ column ma#or form @ m . , i 1" $ / # m . , # 1" $ / i m.,n1#$/i m.,m1i$/#

"."8 A$ &$ ($ )$

The followin! sequence of operation is performed on a stack


push(1), push (2), pop, push(1), push(2), pop, pop, pop, push(2), pop.

The sequences of popped out alues are *, *, ", *, " *, *, ", ", * *, ", *, *, " *, ", *, *, *

C2-R3

P$0" 2 +4 :

;$n)$#<8 200:

2-

E$.' &$&"2"n& /"%+! * "*&'"# TRUE +# FALSE- C'++ " &'" 2+ & $33#+3#*$&" +n" $n5 ENTER *n &'" 6&"$#-+447 '""& $&&$.'"5 &+ &'" ()" &*+n 3$3"#8 4+%%+!*n0 *n &#).&*+n &'"#"*n(1 9 10,

*." All primiti e recursi e functions can be sol ed iterati ely. *.* &readth 1 first search al!orithm can only be used for undirected !raph. *.- )e0referencin! operator . has the same effect when it is applied to a pointer or to a structure. *.2 &inary search performs efficiently on a linked list. *.4 A symbol table can be constructed usin! binary tree. *.6 A pre0order and post0order tra ersal sequence uniquely defines a tree. *.9 3f an undirected !raph is of <n= ertices and <e= ed!es then the sum of de!rees of all ertices is *e. *.> The ad#acency matrix correspondin! to a !raph consistin! of <n= nodes but no ed!es is a unit matrix. *.A Becursion cannot be remo ed without usin! a stack. *."8Pointers are used for dynamically allocated memory. 3- M$&.' !+#5 $n5 3'#$ " *n .+%)2n X !*&' &'" .%+ " & #"%$&"5 2"$n*n0= !+#5( ,=3'#$ "( , *n .+%)2n >- En&"# <+)# "%".&*+n *n &'" 6&"$#-+447 $n !"# '""& $&&$.'"5 &+ &'" ()" &*+n 3$3"#8 4+%%+!*n0 *n &#).&*+n &'"#"*n(1 9 10, X -." -.* -.-.2 -.4 -.6 -.9 -.> -.A -."8 +rder notation Pattern matchin! )ynamic data structure Hei!ht &alanced Trees )ata structure for back trackin! (ircular list with <head= pointin! to the last node 'uitable data structure for efficiently computin! ad#acent artices of a !i en ertex Partition exchan!e sort 'table sortin! Al!orithm %nique representation for ;ero A?CDEFGHI;KLMNOP'tack )ynamic stora!e allocation TwoCs compliment Primiti e data type Dinite automata Ad#acency list Ad#acency matrix AEF Trees Ad#acency multi list Gueue Tree &readth 1 first )epth 1 first Guick sort mer!e sort (omplexity measurement >

C2-R3

P$0" 3 +4 :

;$n)$#<8 200:

@-

E$.' &$&"2"n& /"%+! '$ $ /%$nA 3$." &+ 4*& +n" +4 &'" !+#5( , +# 3'#$ "( , *n &'" %* & /"%+!- En&"# <+)# .'+*." *n &'" 6&"$#-+447 $n !"# '""& $&&$.'"5 &+ &'" ()" &*+n 3$3"#8 4+%%+!*n0 *n &#).&*+n &'"#"*n(1 9 10, circular queue band one0to0many lo!* n 3nsertion (ompaction ?EHKNBstack sparse depth0first0search n lo!* n Fo!* n / " 5 CFILOsimple queue many0to0many breadth0first search H / ,n / "$ recursi e

ADG;MP2." 2.* 2.2.2 2.4 2.6 2.9 2.> 2.A 2."8

Matrices in which non0;ero entries tend to cluster around the middle of each row are called IIIIIIIIII matrix. A !raph represents IIIIIIII relationship between nodes. IIIIIIIIIII can be used to find the shortest distance between !i en two nodes in a !raph. Time complexity of insertin! an element to a heap of <n= elements is of the order of IIIIIIIII. 3f <H= is the total external len!th of a binary tree with <n= nodes then a era!e number of comparisons for unsuccessful search is IIIIIIIIIIIIIIII. IIIIIIIII data structure may !i e o erflow error, e en thou!h the current number of elements in it is less than its si;e. (on ersion of infix arithmetic expression to prefix expression requires the use of IIIIIIIIII. The minimum number of ed!es in a connected cyclic !raph of <n= ertices isIIIIIIIII. Finked list is preferred o er an array for IIIIIIIII operation. Becursion often pro ides ele!ant solution to pro!rammin! task but IIIIIII function chew up a lot of memory.

C2-R3

P$0" @ +4 :

;$n)$#<8 200:

PART TWO (Answer any FOUR questions, Ca$ ?hat are the limitations of array data structure@ b$ 'how with the help of an example, how the abo e limitations can be a oided by <linked= representation of lists@ c$ 'how the representation of linked lists usin! arrays. d$ ?hat do you mean by linear list and !enerali;ed list@ (@D@D@D3, :a$ ?rite a <(= function to copy one stack to another assumin! the stack is implemented usin! array. b$ ?rite an al!orithm to e aluate Postfix expression with the help of a stack. (EDF, Fa$ ?rite a <(= function to implement the Jnuth Mooris Pratt al!orithm for strin! searchin!. b$ A function A,m,n$ is defined as follows. A,m,n$ K n / ", if m K 8 K A , m 1 ", "$, if n K 8 K A,m 1 ", A,m, n0"$$, otherwise write a recursi e <(= function to compute A,m,n$ (EDF, E-

a) Pro e that the maximum number of nodes in a binary tree of hei!ht <k= is *k/"0".
b$ (onsider the followin! binary tree

3ndicate the output in the followin! cases7 0 i$ ?hen the tree is tra ersed in an <inorder= fashion. ii$ ?hen the tree is tra ersed in an <preorder= fashion. iii$ ?hen the tree is tra ersed in an <Postorder= fashion. (:DG3H3I,

C2-R3

P$0" C +4 :

;$n)$#<8 200:

Ja$ 'how with the help of an example that the simple selection sort is not data sensiti e. b$ Dind the time complexity of the simple selection sort. c$ ?rite a recursi e <(= function to implement binary search. (:D3D:, 10a$ ?rite a <(= function to compute the in0de!ree and out0de!ree of a ertex of a directed !raph when the !raph is represented by an ad#acency list. b$ ?hat is a spannin! tree@ ?hat do you mean by minimal spannin! tree@ (JDG3D3I,

C2-R3

P$0" : +4 :

;$n)$#<8 200:

You might also like