2
DATA STRUCTURES
INTRODUCTION
Everyone knows, what is program? One of the tools for writing the programs
is High Level Language. Almost all high level languages provide the facility of built-
in data structures. Often, we use these tools without concern about their actual
implementation, such as a welder can use a welding machine without knowing much
about electricity. However, built-in data structiires provide limited applications. So in
order to get number of interesting and useful ways of structuring data, programmer
must build various data structures in his program. In this chapter, we will study some
useful data structures.
In order to store and retrieve individual data items, the accessing function are
defined. Due to these functions, the collected data is organized.
For implementation of any data structure we should know:
(a) How much memory space is required
(b) How to access data by coded functions
Data is simply a set of values. Generally collection of data is organized into
hierarchy of fields, records, and files.
e.g. If you consider student's information as follows:
Name Roll No. Physics Chemistry _ | Maths
Sachin 1 91 90 I 92
In above e.g: name, roll no., physics, chemistry and maths are fields. The
collection of actual values of fields forms a record. The collection of such type of
records forms a file.
Primary Key
A certain field may uniquely determine the record in a file. Such a field is
called primary key. In the above example Roll No. is a primary key.
The above organization of data into fields, records, files may not be complex
enough to maintain and efficiently process certain collections of data. For this reason
data is organized into more complex type of structures.
2.1 DATA STRUCTURE
The logical or mathematical model of a particular organization of data is
called data structure. .
The choice of data model depends on two considerations,
1) It must be rich enough in structure to mirror the actual relationships of the
data in real world.Data Structures 33
2) Structure should be simple enough that can effectively process the data
whenever necessary.
Few examples of data structures are array, list, binary ‘tree etc.
Data Structure Operations
_ The data in data structures are processed by certain operations like:
A)Traversing: For processing certain item in tecard, each record is accessed
exactly once. (Visiting a record)”
Searching: Finding jocation of a record with given key value or finding the
~ Jocations of all records, which satisfy one or more conditions.
ayfaserting: Addin ding a new record tothe structure.
ApDeleti \cture.
-5)Sorting: Arranging the records in some order.
SjMerging: Combining the records in twe
sorted file.
ferent sorted files into a single
2.2 ALGORITHMIC NOTATIONS
‘An algorithm is a finite step-by-step list of well-defined instructions for
solving a particular problem. The form for formal representation of an algorithm
consists of two parts,
1) It tells the purpose of algorithm, identification variables, which occur in
algorithm and lists, input data.
2) It contains list of steps that is to be executed.
There are certain conventions, which has to be followed in algorithms.
i) Step, control, exit
The steps of algorithm are executed one after another beginning with step1.
Sometimes control may be transferred to step ‘n’ of algorithm by statement
"goto step n' or using control structures.
The algorithm is completed with the statement 'Exit'.
ii) Comments
It is given in brackets either at beginning or end of step. It indicates the main
purpose of step.
iif) Variables
Variable names are generally given in capital letters. Also variables used as
counters or subscripts are in capitals.
Assignment Statement
It uses: = notation
e.g. MAX: =5
Where MAX is a variable34 Data Structureg
iv) Input / Output
For input read statement is used
Read: Variable name
For output write / print statement is used,
Write: Messages / Variable names
Procedure .
tis used for independent algorithm modules. The term procedure will be used
to describe a certain type of sub algorithm.
Example of algorithm
An algorithm to find largest element in array
A nonempty array DATA with numerical values is given. This algorithm finds
the location LOC and the value MAX of the largest element of DATA. The variable
K is used as a counter.
Step 1 [Initialize] Set K:
MAX:
Step 2 [Increment Counter] Set K: = K+1
Step 3 [Test Counter] If K > N then:
Write LOC, MAX and Exit
Step 4 [Compare and Update]
If MAX — Single Alternative
This structure has the form
IF condition, then:
[Module A]
[End of IF Structure]
Condition No
Module A
Fig. (2.2) Single Alternative
If condition holds true then Module A is executed, otherwise Module A is
skipped and control transfers to the next step of algorithm.
> Double Alternative
This structure has following form
IF condition, then:
[Module A]
Else:
[Module B]
[End of IF Structure]
[woasen] [Nose]
Fig. (2.3) Double Alternative36 Data Strucan,.
If condition is true Module A is executed and if condition is false Module B ig
executed.
Multiple Alternatives
If condition [1] then:
[Module A1]
Else if condition [2] then:
[Module A2]
Else if condition [M] then:
[Module AM]
Else:
[Module B]
[End of if structure]
Example of Selection Logic;
Algorithm
This algorithm inputs the coefficients A, B, C of a quadratic equation and
outputs real solutions if any,
Step 1: Read: A, B, C
Step 2: Set B?-4AC
Step 3: If D>0, then:
a) Set X1:=[-B + /D] 2A
and X2:=[-B-/D]/2A
Else if D = 0, then:
a) SetX:=-B/2A
b) Write: ‘UNIQUE SOLUTION’
Else:
Write ‘NO REAL SOLUTIONS
[End of IF Structure]
Step 4: Exit
3) Iteration Logic
Generally these types of structures are called loops. In that two types of loops art
there, 1) Repeat for, 2) Repeat while
1) Repeat ... for
Form
Repeat for K = R to S by T
[Module]
[End of loop]Data Structures 37
Where K = Index variable
Initial value of K
Final value of K
T = Step (increment/decrement)
*The loop is executed for all values of K starting from R to S with step of T.
"
‘Yes
Module
Fig.(2.4) Repeat ... For Logic Fig.(2.5) Repeat. While Logic
2) Repeat ... while
It uses a condition to control the loop.
Form
Repeat while condition:
[Module]
[End of loop]
The loop continues till a condition is true. There must be initialization
statement and there must be a statement that will change index variable in loop.
Algorithm using Repeat while loop (To find largest element in array.)
Given a nonempty array DATA with N numerical values. This algorithm finds
the location LOC and the value MAX of the largest element of DATA.
1 [Initialize] Set K:=1,LOC:=1
and MAX: = DATA [1]
2 Repeat steps 3 and 4 while K<= N
3 If MAX K
[Move J" element downward] Set LA [J+1]:=LA {J]
{Decrease Counter] Set J: 1
[End of step 2 loop]
[Insert element] Set LA [K]: = ITEM
[Reset N] Set N: = N+]
Exit
Pee
spe
Number 9 is inserted 4 is deleted
3 3
4 4
5 9
6 5
8 [6
8
Original ‘Addition of
Array element in
middle array
Fig. (2.6)
Deleting Element in array
It refers to the operation of removing one of the elements from A. Deleting at
an end of array is simple but deleting an element somewhere in the middle of the
array would require that cach subsequent element be moved one location upward ia
order to fill up the array.
Algorithm for deleting an element
This algorithm deletes the K™ element from a linear array LA and assigns it
a variable ITEM.
DELETE [LA, N, K, ITEM]
LA =Linear array _N = Total no. of elements in array
K = Any positive integer such that K<= N, Data Structures 41
3. [Move J+1" element upward.] Set LA [J]:
[End of loop]
4. [Reset the number N of elements in LA.]
Set N: =N-1
LA (J4+1]
5. Exit
2.4 BUBBLE SORTING
Sorting means, rearranging the elements in increasing or decreasing order
Suppose A[1], A(2],..... A[n] are in memory. Then bubble sort algorithm works as
follows:
Compare A [1] and A [2] and arrange them in the desired order, so that A [1],
A[2]. Then compare A [2] and A [3] and arrange them so that A [2], A [3]. Continue
this process until we compare A [N-1] with A [N] so that A [N-1], A [N].
Step 1: It involves n-1 comparisons. During this step, the largest element is coming
like a bubble to the n” position. When step 1 is completed A[N] will contain the
largest element.
Step 2: Repeat step 1 with one less comparison. Step 2 involves n-2 comparisons,
when step 2 is completed we get second largest element A[N-2].
Step 3: Repeat step 1 with two less comparisons. It involves N-3 comparison.
Step N-1: Compare A[1] with A[2] and arrange them so that A(1] [A[2].
After n-1 steps the list will be sorted in increasing order.
Pass
The process of sequentially traversing through all or part of a list is called a
pass. Each of above step is actually a pass. The bubble sort algorithm requires N-1
passes where n is number of input items.
The time required for sorting algorithm is measured in terms of comparisons.
Specifically there are n-1 comparisons during first pass n-2 comparisons in second
pass and so on.
Complexity of algorithm
f(n) = (n-1) + (n-2)+....4241
n(n-1)
=r
n’
=3+ O(n)
=0(n’)
‘The time required to execute bubble sort algorithm is proportional to n? where
nis number of input items,.
42 Data Structry
—_ lM
Algorithm
[Bubble Sort] BUBBLE [DATA, N]
Here DATA is an array with N elements. This algorithm sorts the elements in
DATA.
1. Repeat steps 2 and 3 for K = 1 to N-1
2. Set PTR: = 1 [? pass pointer PTR.]
3. Repeat while PTR<= N-K. [Executes pass.]
a) IF DATA [PTR] > DATA [PTR + 1], then:
Interchange DATA [PTR] and DATA [PTR + 1]
(End of IF structure)
b) Set PTR: =PTR+1
{End of inner loop.]
{End of step 1 outer loop.]
4. Exit
Searching
Searching refers to the operation of finding the location of given element in
the list. The most commonly used searching algorithms are linear search and binary
search.
In linear search the given element is compared with each element of list one
by one. This method is also called sequential search.
Algorithm Linear Search
LINEAR [DATA, N, ITEM, LOC]
Here DATA is a linear array with N elements and ITEM is a given item of ;
information. This algorithm finds the location LOC of ITEM in DATA or sets
LOC: = 0, if search is unsuccessful.
1. [Insert ITEM at the end of DATA] set DATA [N+1]: = ITEM
2. [Initialize counter] set LOC: =.1
3, [Search for ITEM]
Repeat while DATA [LOC] # ITEM . i
Set LOC: = LOC +1
[End of loop] . . i
4. [Successful?] IF LOC = N+1 then set LOC: = 0 |
5. Exit
2.5 BINARY SEARCH
While using this searching method array should be sorted in increasing {
numerical order.
Suppose DATA is an array, which is sorted in increasing numerical order, and
we want to find out the location LOC of a given ITEM of information in DATA.
Then binary search algorithm applied works as follows. During each search
for ITEM is reduced to a segment of elements of data:
DATA [BEG], DATA [BEG +1], DATA [BEG+2]...... DATA. [END]Data Structures 43
Seana
Here BEG and END variables denoted beginning and end locations of the
segment under consideration. This algorithm compares [TEM with middle clement
DATA [MID] of the segment where MID is obtained by
MID = INT [(BEG + END)/2]
If DATA [MID] = ITEM then the search is successful and we set LOC: =
MID otherwise a new segment of DATA is obtained as follows,
a) If ITEM DATA [MID] then ITEM can appear only in the right half of
the segment.
DATA [MID+1], DATA [MID+2],..... DATA [END]
So we reset BEG: = MID+1 and begin searching again.
c) If ITEM is not in DATA then eventually we obtain END < BEG
It means that search is unsuccessful. In this case we assign LOC: = NULL
(Generally we begin with BEG=1 and END=N or more generally we can say
BIG=LB and END=UB) e
Algorithm for Binary Search
(Binary Search) BINARY [DATA, LB, UB, ITEM, LOC]
Here DATA is sorted array with lower bound LB and upper bound UB and
ITEM is given item of information. The variables BEG, END and MID denote
respectively the beginning, end and middle location of a segment of elements of
DATA. This algorithm finds the location LOC of ITEM in DATA or set
LOC=NULL.
1. [Initialize segment variables.]
Set BEG: = LB, END: = UB and MID=IN¥ ((BEG+END)/2]
2. Repeat steps 3 and 4 while BEG <= END and DATA [MID] # ITEM
3. IFITEM
Doe
: Team [L] and Team (L+1]-1 contains respectively the first and last elements
in Team L.
eg. Team 1———»>]1 ———> first element of Team 1
Team [1+1]-1———» 4 ———> last element of Team |
Team 4 points to the sentinel of lists.
2.7 RECORD
A record is collection of related data items. Each data item is termed as field.
File is collection of similar records. Each data item may be a group item composed of
sub items.
Comparison
Record Linear Array
(1) Arecord may be a collection of The data items in an array
non homogeneous data; may have same data types.
ie. the data items in a record may
have different data types.
(2) The data items in a record are There may be natural
indexed by attributes . ordering of its elements.
So there may not be a natural
ordering if its elements
Example of Record
2 Suppose a college keeps a record of each student, which contains the
following data items.
ITEM SUBITEM
Name Last, First, MI (Middle Initials)
Address
Stream division
Phone
The structure of above record is described as follows:
1, Student
2. Name
3. Last
3. First
3. MI (Middle Initial)
2. Address
2. Phone
2. Stream
3. DivisionThe mumber to the left of ioc mame (ie sicasifying) opecoces &
sumber. Sub iacms follow cach group items and the level of sub isems ss I
the level of group item.
Generally for separating seb iaemas from group iacms dot is used.
Representation of records in memory
Simce records comin nonbomogeacous data it can't be stored im array. Some
higher-level languages are having built im second stractere (for cg PL/I, PASCAL,
COBOL). Suppose these types of structures asc not available in language then soon
has to be stored in imdivideal variables. But if we want to keep cafisc file of seconds,
then all data clemeats belonging to the same idestifier will be of same type. So a file
may be stored m memory as collection of arrays.
eg Student file
Name Address Phone Soream
Kolkami SmitaL. 19, Shaniwar Peth 4456184 Ans
Patil Aja D. 24,MG. Road 61a (Commerc
Here clements im arrays name, address, phone. and stream,
subscript belong to the same record.
2.8 LINKED LIST
Linked list or one-way list is a linear collection of data elements
where the linear order is given by means of pointers. Each mode is divided into’
1. First part contains the information of the element.
2 Second part contains the address of next node in list (it is called link field}.
START is a pointer variable, which contains the address of first node.
Left part represents the information part of the node while rij represents
the next poimerficid of node. The poimer of last node contains « neeeiel cole call
NULL, which is an invalid address. a
‘The schematic diagram of a linked list with 4 nodes is shown below,Data Structures 47
Information part of node 2
Next pointer field of node 2
Fig. (2.8) A Linked List
‘The following diagram shows a linked list
1) Name of player and no. of runs from an information part while next
pointer field gives the next node's address in linked list.
1) Start ——> 4
2)4-——> 1
3) 1 ——>3
4)3 ——+2
5) 2 ——— last node
Fig. (2.9)
Representation of Linked List in Memory
Let List be a linked list. Then LIST will be maintained in memory as follows,
1) LIST requires 2 arrays; we will call them here INFO and LINK such that
INFO [K] and LINK [K] contain respectively the information part and
next pointer field of a node K of list.
2) LIST also requires a variable name such as START, which contains the
location of beginning of list and next pointer sentinel denoted by NULL,
which indicates end of list.
The following e.g. shows how linked list is stored in memory. The nodes of
the list need not occupy adjacent elements in the arrays INFO and LINK and more
than one list may be maintained in the same linear arrays INFO and LINK. But each
list must have its pointer variable giving the location of its first node.td dah (Sl contig node C)
Nave which ka child (or cron). is parent of B
“ie od wich no ir ce) D G.K.M
Troma lave te same paca The nodes containing
2) INFO [12}= 7, LINK [12}= 0... lat node cea tee :
ie. “LINK LIST” string is stored inform of Linked List. D and E ae both children of the node containing B.
These nodes are siblings. _
‘Advantages of Linked List ANCESTOR —:_The node is an ancestor of another node. if i is a pareat
eal Ut tre in fom of ara, Bat in ays inte of tht noe The acs of he nde coining G
' deletion isnot easy. Also array size cant be easily increased. Using linked lit ee ees
— DESCENDANT : _The node is a descendant of another node, if it is a child
ofthat node. The descendant of the node containing E
aoa ea Ta STRUCTURE ink i are the nodes cootaining G, H, K. All nodes in the tree
Tn ease of Link data structure, each node has link information of next mit Te desoentans of the ROOT.
‘Thus sequeatially, we can access all the nodes. It will be time consumiae fe ca
— Fe seen eet a LEFT SUBTREE ‘The descendants of root's lft child which acts a root of
Th omer to reduce time consumption, binary tree concept was deve! RI dents cf not 224 .
phe oeerenics Neary toe f GHT SUBTREE : The root's right child which acts a root of
‘Tree is an hierarchical structure of collected data itemsIt is nonlae = LEVEL The distance from the ROOT, The ROOT is always at
structure. zero (0) evel.
[Node It is as clement of lst. Tt may be a character, string or number.
1, | zzFig. (211)
‘Types of Tree
‘Trees can be classified according to node structure such as
1) Nall tree: a tree without node.
2) Binary tree : A tree which has left and right child
3) Ordered tree : Children of each node are ordered from Left to Right,
4) Nonordered tree : Children ofeach node are not ordered from Left to Rigiy
Binary Tree
Abinary tree T is defined asa finite set of elements called nodes, such tha
1) T is empty (called NULL wee or empty tree) or 2) T contin
distinguished node R called the root of T and remaining nodes of T form an orec,
pair of disjoint binary trees T; and T;.
eg. A
oN
wo Nn N\in
-
y
Z «
“if T contain a rot R then the two trees T; and Ts are called respectively kt
and right sub tees of R. If, is nonempty, then its rot is ealled left soecceee ek
‘Similarly ifT; is nonempty then its root is called right successor of R.
1) Bisleft successor of A and Cis right suecessor of node A refer fig (2.12.
2) The left sub tre of root A consists of node B, D, and B and the right subuee A
ay (ais fans CG, HJ, Kand L
‘Any node N in a binary tre T has either 0, 1,2 successors. The nodes A, B,C!
have two successors. The nodes D, E, G, L ‘ene eto
ee D,E, G, Land K have no successors that 10!
ary tree T and T afe said to be similar if they have same structure. The trees
are id ‘be copies if they are similar and if they have same contents at
ia yressions
Algebraic Expert represented as tre, Each variable or constant in E appears as
sterol a002 of T whose left and right subtrees corresponding to the operands of
operation. E=(a-b)'M(c*d)+e)
7\
by {\
Brel
: : Fig. (2.13)
Complete Binary Tree
Consider any binary tree T. Each node at T can have at most two children.
wel r of T can have at most 2' nodes. The tree T is said to be complete if all us
level F -
nels except possibly the last have maximum no. of possible nodes and if all the
‘podes at the last level appear as far as left as possible,
ZN
fo 1,
A OT AW AN
Fig. (2.14) 8 910 142 t914 Ys
‘The left and right children of node K are 2* K and 2* K+ 1 and the parent of
Kis the node K/2.
eg. 4" node
Parent node ———* 4/2 =2
Children. ~——» 1) 4°2=8 24*2)+1=9
‘The depth of complete binary tree is given by,
Dn = flog: n+ 1]BS
inary tre, if each
Batended Binary 17 sid be Zee or exten eg mca Vi
cite tor orn, nis case nes with 2 a? al ogg,
we nodes with 0 cil 22 woe by replacing each emp,
‘Any binary tree may me az internal nodes inthe exe?
Binary Tree (Original)
i anne oaistiand {€xtomal Binary Tree)
—> External
Fig. (2.18)
Representing binary trees in memory
Let T be a binary tree. There are two way of representing binary tres iy
memory. 1) Linked representation 2) Sequential representation,
1) Linked representation
‘In this method 3 parallel arays are used INFO, LEFT and RIGHT.
1) INFO [K] contains the data at node N.
2) LEFT [K] contains the location of left child of node N.
3) RIGHT [K] contains the location of right child of node N.
4) ROOT will contain the location of root R of T. It is a pointer variable
5) If any subtree is empty then coresponding pointer wall contain anal
value.
x] Tx
Figi2.16)
ota structures 33
INFO | LEFT | RIGHT
1
root 2/_¢ | 0 a
smu] 3 |B | 0 0
4[HTs 0
L$ FEE
cals Io. 0
7 eo 0
8
9
w BF 3
‘Sequential Representation
‘Suppose T is complete binary tree then only single linear array TREE is used
as follows:
1 [es
2 [2
4 a [a7
oS 4
s [30
2 7 é
/\ \ iB
8 Cs
1 % 9
le / wif
6 8 es ou
12
B
Fig. (2.17) 1“ a
1) The root R is stored in TREE [0]
1) Ifnode N occupies TREE [K] then left child is stored in TREE [2 * K] and
its right child is stored in TREE (2 * K + 1]
2) If TREE [1] = NULL then itis empty.
at one end, called the top of stack. Elements are removed from a stack in a reverse
‘order of that in, which they were inserted into the stack. So itis generally referred as,aN
‘Last In First Out structure),
Tao sions ca with sack we ws
Drop Toda mn cent fom a stack
Best example of stack is stack of dishes.
SS —_a shed onto the stag
1 2 3 4 5 6--- Wy
Pentium ] 8085 BOsT | 80486] 8255
microprocessor | microcontroller a
Top of Stack
In this case 4% clement can't be deleted before 5" element. In the same way
{for other elements also. The elements may be popped from the stack only in revere
‘onder ofthe in which they were pushed oato the stack.
‘Queue
‘A queue is a linear list of elements in which deletions can take lac ony &
coe end called the front and insertions can take place only at other end called ther
(Queues are alo called FIFO (First In First Out lists) ie. fist element in ue
willbe first element out of the queue. Queues abound in every day life. Eg qvte
waiting for a bus.
‘eg fig. shows a schematic diagram of a queue.
1)
J eS bos ble blo]
‘Front element pen eamont
ata structures 55
aes OO Om
2) Suppose Ais deleted from queve:
Le be Lo
v
Front element Rear element
3) B&F élements are added:
(le ble Le ble Pe
y T
Front element Rear element
4) Bis deleted:
(le o ble Pe
ib J
Front element Rear element
QUESTIONS
41) Select the correct alternative and rewrite the following:
situation when data is to be stored and retrieved in
(Mar. 2019)
r
4) Stack, ii) Queve, ii) Linked Lis, iv) Tree
4) The number of comparisons required for bubble sorting of an array of ‘a!
‘elements is_. (Specimen Paper)
4) n(n-1)/2, i) 1/2, it) logan, iv) logion
) ___. is the operation of rearranging the elements of an array cither in
increasing or decreasing order.
4) Sorting, ii) Searching, iii) DMS, iv) DBMS (Apr 90)ni
is + (Mar.2003,15
1) Accessing each element of an array only once is called ——-
i) Traversing, ii) Searching, iii) Locating, iv en
pbney Sens jae sok Bl so) Poin See ca as Fast = ery. (Mar 2092016
h) Finding the location of record with a gi is known as (Mar.2095) v lar. 02, 05, 07, 08)
4) Traversing b) Searching ° 4) Inserting
i) Maximum number of nodes of symmetric binary tree with depth of 7 is ry vat do you nee 7 aoe
3) 125 b)127 128 124 (Mar. 08) + witha? plain lines sechng goin a
|p Stored list is essential in process of an array. (Mar.2019) 5
i) Linear Search ii) Binary Search iii) Traversing, iv) Insertion 18, How Linked list are represented in memory? (Mar. 2017)
) Record contains —— data, (Mar.2009) 19, What is meant by Linked ist? With suitable examples show the representation of
§) Homogeneous ii) Non-homogeneous ii) same iv) none of these tinked list in memory. eae
1) — data structure does not require contiguous memory allocation. 0. What is linked lst? Show a linked list with suitable example having six nodes
s)aray by string -—¢) pointer array d) Linked list (Mar.2015) with a properly labeled diagram. (Mar. 03, Mar. 67, Mar. 05)
mm) A record is collection of — (Mar.2017) 21. With a suitable example and diagram show a link list with information elements
)files b) arrays) fields.) maps and the link fields from start to null pointer, (March 2005)
2. Define the terms: a) Field b)Record c)File (March 2009) 22. With a ae ee show yabeied diagram for link between two nodes
3. Explain the following data structures with suitable diagram. having the information part and next pointer field. (March 2006)
1) Linear array, b) Linked list, c) Tree (Mar.2003,11) 23, Explain the advantages of binary search algorithm with a suitable example. State
anfy two disadvantages or limitations of binary search. (Mar. 07)
4. Whatis linked list? Explain it with suitable example,
24, Explain the bubble sort algorithm with suitable example. (Mar.02,05,Mar.08,20)
‘5, What are types of binary tree? Explain it with suitable example.
6, What is Binary Tree? With a suitable example, explain the terminology. Describe 25. What is sorting? Explain bubble sorting algorithm, (Mar.2011)
ionship between the elements ofa bit .
pa ots bomen ane (Mtar.05,11) 26, What is binary tree? Draw the tree structure forthe following expression:
7. What is a Binary Tree? With a suitable example, show the relationship betwees -
total number of nodes and depth of a binary tree, (Mar.06) E=(a-by{(c* d) +e] (feet mean)
8. How binary trees are represented in memory” Explain it, 27. Draw the tree structure for the following expression:
9. Write the difference between linear search and binary search. (Mar. 2017) [a+ (b-c)] * [-e)/ (f+ g-b)) (Specimen Paper)
10, Explain any four data structure operations. 25. What is binary tree? Draw the tree structure forthe following expression:
11, Explain data structure array, E=(atbyi(c* d)-e] (Mar. 2004)58 Data ‘Structure,
26 .With suitable example and labelled diagram show the representation of binary }
tree in memory. (March 2003)
27.Draw the tree-diagram which corresponds to the following algebraic expression:
E=(2X+Y)/(5A-B)? (Mar. 06)
28.What is Binary Tree? Draw the binary tree structure for the following expression:
[(a+b) * c]/[a* (b-c) +a] (Mar, 08)
29.What is Binary Tree? Draw tree structure for the following expression:
E=(a-b)/((c*d) +e) (March 2007)
30. Show the representation of records in memory considering suitable example of
three records and three fields. (Mar.03) |
31. Explain with flowcharts the following control structures. (Mar.2009,2017) |
a) Sequential b) Selection logic c)Iteration logic
32. With suitable example show representation of Binary tree in a memory.
(Mar.2009)
33. Explain bubble sort algorithm with suitable example. (Mar.2017)
34, Explain Binary Search algorithm with a suitable example. (Mar.2019)
35. What is Binary Tree? Draw the Tree diagram for the expression. |
B=(3R/ST)-(R+Q) (Mar.2019) \
36. What are the functions of Memory Management? State any two types of |
continuous Real Memory Management System. (Mar.2019) |
37. Explain internal and external fragmentation in memory management of operating
system. . (Mar.2020)
38. Define linked list. Draw and explain labelled diagram of linked list
with 5 nodes. (Mar.2020)
Answers Q.(1)
(a) 31 (b)searching (c)stack (d)n(n-1)/2_ (e)Sorting (fTraversing
(g)Binary search (h) Sorting (i) 127 (j) Binary Search (k) Non-homogeneous.
() Linked list (m) fields
Qaa