0% found this document useful (0 votes)
22 views2 pages

F I. Abstraction? Ii. Examples. Algorithm.: of of

Uploaded by

teamapexa2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views2 pages

F I. Abstraction? Ii. Examples. Algorithm.: of of

Uploaded by

teamapexa2024
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

rs

Rajarata Un Sri Lanka


Faculty of Applied Sciences
B.Sc. (lnformation and Communication Technology) Degree
Year ! - Semester l! Examination -March 2014
Data Structures - ICT 1305

Answer all questions Time Allowed: Three (03) hours

f i. what is meant by data abstraction? (04 Marks)


ii. For most of known data structures, required memory can be allocated
dynamically or statically. Discuss how to decide which kind of memory
allocation is suitable for a particular case using examples. (08 Marks)
iii. What are the factors that you should consider when measuring the efficiency
of an algorithm. (05 Marks)
iv. suppose you need to read a given text and count the frequency of
occurrences of each word appeared in the text. Suggest a suitable structure to
store the list of words along with their frequencies. Explain its usage. (05 Marks)

)
i. List five applications that use stacks as tools. (05 Marks)
ii. A route-map of a city can be modeled using dynamically linked nodes, if there
is a provision to keep the list of neighboring locations with a node. Suggest a
rlurt for
suitable structure Lrrr) purpose.
rur this L'elllle the
PUrPU>e' Define Lrle suggesrea structure uslng
suggested srrucrure usin
(09 Marks)
C/C++.
iii. lmplement a method to count and print the number of neighbors of each
location of the map implemented using the structure in above ii. (06 Marks)

3' i. Rewrite the following expressions in prefix and postfix notations,

a. a+(b+c*(d-f))/g+h
b. ((a+b*c)*(d-e))/(f+g)+h (04 Marks)

ii. Explain the steps of evaluating a given postfix expression using a suitable data
structure. (06 Marks)

iii. Convert the expression o/2 + b * ((c+ d)/e) +f*g into postfix and illustrate the
evaluation of it using the algorithm developed in above ii,
"' if" a=9,
- -' b-3, c-s, d=7
e=6,f=2and g=1. (04 Marks)

iv. Assume that you have declared the structure of a doubly-linked list. Write a
C/C++ function to insert an item into a sorted doubly-linked list. (08 Marks)
I Compare and contrast array based queues and priority queues. (04 Marks)
il Explain the processes of percolating down and percolating up in priority
queues.
(05 Marks)
lnsert the following list of numbers into a priority queue assuming the least
has the highest priority.
List: 12,5,10, 8,4, L5, 20,9, L (04 Marks)
iv. lllustrate the removal of highest priority value of the above priority queue. (02 Marks)
v. Write a CIC++ function to insert an item into a priority queue. (04 Marks)

5
I Write the recursive definition of the binary search tree (BST) structure. (04 Marks)
il Define the following terms with respect to BST:

a. Descendents d. Skewed tree

b. Depth of a node e. Full tree (04 Marks)


iii. Construct a BST using 20,15,10,30, 78,25,40,50,35, and 37. (02 Marks)
iv. Depict the removal of node 30 and node 15 from the tree above in iii. (04 Marks)
v. Consider the following tree traversal algorithm:

Staft
lnitiolize two queues Q7, Q2
Node=root of the tree
lnsert Node into Q7
WHILE Ql is not EmpU
Node = remove first of Ql
lnsert the volue of Node into Q2
lf there is left child of Node insert left child into Ql
lf there is right child of Node insert right child into el
END WHILE
Print Q2
End

a. Traverse the tree above in iii. using this algorithm and write the output. (04 Marks)
b. What does this algorithm demonstrate? (lnterpret the output) (02 Marks)

You might also like