You are on page 1of 9

Visit www.aucse.com A website on big ideas!

Data Structure
1. What is data structure? A data structure is a way of organizing data that considers not only the items stored, but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data. 2. List out the areas in which data structures are applied extensively? Compiler Design, Operating System, Database anagement System, Statistical analysis package, !umerical Analysis, "raphics, Artificial #ntelligence, Simulation !"#$%

3. What are the major data structures used in the following areas : &etwor' data model ( )ierarchical data model. $D% S & Array 'i.e. Array of structures( !etwork data model & "raph )ierarchical data model & *rees

*. +f you are using , language to implement the heterogeneous lin'ed list% what pointer type will you use? *he heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. #t is not possible to use ordinary pointers for this. So we go for void pointer. +oid pointer is capable of storing pointer to any type as it is a generic pointer type. -. #inimum num.er of /ueues needed to implement the priority /ueue? *wo. One ,ueue is used for actual storing of data and another for storing priorities. 0. What is the data structures used to perform recursion? Stack. %ecause of its -#.O '-ast #n .irst Out( property it remembers its /caller0 so knows whom to return when the function has to return. $ecursion makes use of system stack for storing the return addresses of the function calls. 1very recursive function has its e/uivalent iterative 2non3recursive4 function. 1ven when such e,uivalent iterative procedures are written, e2plicit stack is to be used.

Visit www.aucse.com A website on big ideas! 5. What are the notations used in 1valuation of 6rithmetic 1xpressions using prefix and postfix forms? 4olish and $everse 4olish notations. 7. ,onvert the expression 226 8 "4 9 , : 2! : 14 ; 2< 8 =44 to e/uivalent >refix and >ostfix notations. 4refi2 !otation5 6 7 8 9A%C 7 D1 9 ." 4ostfi2 !otation5 A% 9 C 8 D1 7 7 ." 9 6 ?. $orting is not possi.le .y using which of the following methods? 2a4 +nsertion 2.4 $election 2c4 1xchange 2d4 !eletion 'd( Deletion. :sing insertion we can perform insertion sort, using selection we can perform selection sort, using e2change we can perform the bubble sort 'and other similar sorting methods(. %ut no sorting method can be done ;ust using deletion. 1@. 6 .inary tree with 2@ nodes has null .ranches? <3 -et us take a tree with = nodes 'n>=(

!ull %ranches

#t will have only ? 'ie,=93( null branches. #n general, 6 .inary tree with n nodes has exactly n+1 null nodes. 11. What are the methods availa.le in storing se/uential files ? Straight merging, !atural merging, 4olyphase sort, Distribution of #nitial runs.

<

Visit www.aucse.com A website on big ideas!

12. )ow many different trees are possi.le with 1@ nodes ? 3@3A .or e2ample, consider a tree with B nodes'n>B(, it will have the ma2imum combination of = different 'ie, <B 7 B > =( trees.

ii

iii

iv

#n general5 +f there are n nodes% there exist 2n-n different trees. 13. List out few of the 6pplication of tree data3structure? *he manipulation of Arithmetic e2pression, Symbol *able construction, Synta2 analysis. 1*. List out few of the applications that ma'e use of #ultilin'ed $tructures? Sparse matri2, #nde2 generation. 1-. +n tree construction which is the suita.le efficient data structure? 2a4 6rray 2.4 Lin'ed list 2c4 $tac' 2d4 Aueue 2e4 none 'b( -inked list 10. What is the type of the algorithm used in solving the 7 Aueens pro.lem? %acktracking 15. +n an 6BL tree% at what condition the .alancing is to .e done? #f the /pivotal value0 'or the /)eight factor0( is greater than 3 or less than &3. 17. What is the .uc'et siCe% when the overlapping and collision occur at same time? One. #f there is only one entry possible in the bucket, when the collision occurs, there is no way to accommodate the colliding value. *his results in the overlapping of values.

Visit www.aucse.com A website on big ideas! 1?. Draverse the given tree using +norder% >reorder and >ostorder traversals. "iven tree5
A

"

#norder 5 D ) % 1 A . C # " C 4reorder5 A % D ) 1 C . " # C 4ostorder5 ) D 1 % . # C " C A 2@. Dhere are 7% 1-% 13% 1* nodes were there in * different trees. Which of them could have formed a full .inary tree? 3=. #n general5 Dhere are 2n-1 nodes in a full .inary tree. "y the method of elimination: .ull binary trees contain odd number of nodes. So there cannot be full binary trees with D or 3A nodes, so re;ected. Eith 3B nodes you can form a complete binary tree but not a full binary tree. So the correct answer is 3=. Note: .ull and Complete binary trees are different. 6ll full .inary trees are complete .inary trees .ut not vice versa. 21. +n the given .inary tree% using array you can store the node * at which location? 3

<

A =

Visit www.aucse.com A website on big ideas! At location ? 3 $oot < -C3 B $C3 7 -C< 7 $C< A -CB 7 $CB 7 -CA = $CA

where -Cn means -eft Child of node n and $Cn means $ight Child of node n 22. $ort the given values using Auic' $ort? ?= F@ F= D@ D= ?@ == =@ A=

Sorting takes place from the pivot value, which is the first value of the given elements, this is marked bold. *he values at the left pointer and right pointer are indicated using - and $ respectively. 65 F@F= D@ D= ?@ == =@ A=$

Since pivot is not yet changed the same process is continued after interchanging the values at - and $ positions 65 65 65 65 A= A= A= A= F= =@ =@ =@ D@ D@ == == D= D= D= ?@ $ ?@ ?@ ?@ $ D= == == $ D@ D@ =@ $ F= F= F= F@ F@ F@ F@

Ehen the - and $ pointers cross each other the pivot value is interchanged with the value at right pointer. #f the pivot is changed it means that the pivot has occupied its original position in the sorted order 'shown in bold italics( and hence two different arrays are formed, one from start of the original array to the pivot position73 and the other from pivot position93 to end. 60 55 50 A= A= A= $ =@ =@ $ 55 == $ 60 60 65 65 65 85 70 $ 70 D@ D@ D@ F= F= F= $ F@ $ 85 85

#n the ne2t pass we get the sorted form of the array.

Visit www.aucse.com A website on big ideas! 45 50 55 60 65 70 75 80 85

23. <or the given graph% draw the !<$ and "<$?

A G "
"<$: !<$: AG")41 AG)41H

*he given graph5

) 1 4
HC C"

H C

2*. ,lassify the )ashing <unctions .ased on the various methods .y which the 'ey value is found. Direct method, Subtraction method, odulo7Division method, Digit712traction method, id7S,uare method, .olding method, 4seudo7random method. 2-. What are the types of ,ollision esolution Dechni/ues and the methods used in each of the type? Open addressing 'closed hashing(, *he methods used include5 Overflow block, Closed addressing 'open hashing( *he methods used include5 -inked list, %inary treeI

20. +n !"#$% what is the efficient data structure used in the internal storage representation?

Visit www.aucse.com A website on big ideas! %9 tree. %ecause in %9 tree, all the data is stored only in leaf nodes, that makes searching easier. *his corresponds to the records that shall be stored in leaf nodes. 25. !raw the "3tree of order 3 created .y inserting the following data arriving in se/uence : ?2 2* 0 5 11 7 22 * - 10 1? 2@ 57
33

3J

<A

3?

<@

<<

FD

J<

27.Ef the following tree structure% which is% efficient considering space and time complexities?
2a4 +ncomplete "inary Dree 2.4 ,omplete "inary Dree 2c4 <ull "inary Dree 'b( Complete %inary *ree. "y the method of elimination: .ull binary tree loses its nature when operations of insertions and deletions are done. .or incomplete binary trees, e2tra storage is re,uired and overhead of !:-- node checking takes place. So complete binary tree is the better one since the property of complete binary tree is maintained even after operations like additions and deletions are done on it. 2?. What is a spanning Dree? A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized. 3@. !oes the minimum spanning tree of a graph give the shortest distance .etween any 2 specified nodes? !o. inimal spanning tree assures that the total weight of the tree is kept at its minimum. %ut it doesnFt mean that the distance between any two nodes involved in the minimum7spanning tree is minimum. 31. ,onvert the given graph with weighted edges to minimal spanning tree.

Visit www.aucse.com A website on big ideas!

3
A3@

?@@

?3<
<JD=

B
B3@

<@@

=
A@@

<

3A<3

the e,uivalent minimal spanning tree is5 3

B ?3< B3@ A <@@ =

A3@ <

32. Which is the simplest file structure? 2a4 $e/uential 2.4 +ndexed 2c4 andom 'a( Se,uential 33. Whether Lin'ed List is linear or &on3linear data structure? According to Access strategies -inked list is a linear one. According to Storage -inked -ist is a !on7linear one. 3*. !raw a .inary Dree for the expression : 6 9 " 3 2, 8 !4 9 2> G A4 7 8

3-. <or the following ,E"EL code% draw the "inary tree? C D D 4 L

Visit www.aucse.com A website on big ideas! @3 S*:D1!*M$1C. @< !A 1. @B .#$S*M!A 1 4#C G'3@(. @B -AS*M!A 1 4#C G'3@(. @< H1A$MO.MS*:DH. @B .#$S*MS1 4#C GG. @B S1CO!DMS1 4#C GG. @3 S*:D1!*M$1C

@<
!A 1

@<
H1A$MO.MS*:DH

@B
.#$S*M!A 1

@B
-AS*M!A 1 .#$S*MS1

@B
S1CO!DMS1

@B