0% found this document useful (0 votes)
24 views3 pages

Umversity Lanka: Rajarata Faculty Applied

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)
24 views3 pages

Umversity Lanka: Rajarata Faculty Applied

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/ 3

RAJARATA UMVERSITY OF SRI LANKA

FACULTY OF APPLIED SCIENCES

B.Sc. (General) Degree in Information & Communication Technology


First Year Semester II Examination - AprilAvlay 2015

ICT 1305 - Data Structures

Time allowed: Three Hours

Instructions to candidates

a This is a closed book examination.


a There are THREE (3) pages in the question paper.
a Question paper consists of SIX (6) questions.
a Answer any FIVE (5) questions
a All questions carry equal marks.

Ql.
l) Linked Lists can be used as a base for other Data Sffuctures. Give 3 examples and
discuss advantages and disadvantages of using Linked Lists over Arrays.
(5 marks)
2) Suggest a suitable Data Structure(s) to store data related to a known number of students
who follows unknown number of courses. The suggested should provide provisions to
store course data which they have registered for. Justif, your answer. (4 marks)
3) Write a CrC++ code segment to implement the above mentioned structure. (5 marks)
A student may have, an Index number, Name, NIC number, List of courses they follow
4) Give two uses of Data Structures and Algorithms (2 marks)
5) Illustrate how to insert an item into a sorted linked list (4 marks)
Total Marks: 20

D'-
Q2.

Write down two direct applications of stack' marks)


(2
l)
write down step by step' (4 marks)
2) Evaluate the given postfix expression using stacks'
512+-2931+x2^4+
expression in postfix notation using a stack'
Illustrate step by
3) Rewrite the following
steP (4 marks)
a*b+c(d*e-f)/g
N number of queens in NxN chess board
4) Write down the pseudo code for'plu.irg
without attacking each other (4 marks)
based stack in c/c++ (6 marks)
5) Implement push and pop methods for a linked list
Total Marks:20

Q3.
,,Queue is an FIFO structure" Is the statement true? Justiff your answer using a suitable
1)
example, (3 marks)
2) Supposethereisaqueueofpatientswhohasanintegerappointmentnumber.Write
dynamic queue' (6 marks)
down C/C+* methods to enqueue and dequeue for a
3) Illustrate irrsertion of the given elements
into the queue given below' lndicate the front
and rear after each insertion (5 marks)
32,10,13,04
FRONT=4

FEAF = 6

4) What is a Priority Queue? Explain by defining


the heap property in Priority'Queues
(3 marks)
to obtain the left child and the right child of ith node of a priority
5) Write the formulas
queue? (2 marks)
Total Marks: 20

Q4.
instead of Binary Tree?
l) what are the advantages of using Binary Search Tree
(2 marks)
a Binary Search Tree'
2) ilustrate the insertion of the given list of items into
List: 12,18,32,06,19,10,1 I
(6 marks)
3) Output the items in the tree in patt (2) using
In Order, Pre order and Post order
traversal rnethods (3 marks)
the above tree in part (2) (5 marks)
4) Illustrate how to delete 35 and then 1 8 from
Tree using suitable diagrams
5) Explain the Full Binary tree and complete Binary
(4 marks)
Total Marks: 20

6{
Qs.

1) What is an does it differ from a Binary Search Tree? (2 marks)


AVL Tree and how
2) What are the 4 cases in rebalancing an AVL Tree? State whether each of
them require
single or double rotation, (6 marks)
3) Define the Balance Factor of a given node using the Heights of the left and the
right sub
trees. (2 marks)
4) Illustrate a Double rotation operation of an AVL Tree using a suitable Diagram
(4 marks)
s) lnsert the following list into anAVL Tree. After inserting each of the items check for
the Balance Factor. If the tree is imbalance, illustrate how to rebalance the tree by
rotating.
List z 22 113,37 15, 28135,40,50
(6 marks)
Total Marks: 20

Q6.

r) What are the two conditions that the output of a sorting algorithm should satisfy?
(4 marks)
2) What is the idea of the selection sort? How does it differ from insertion sort?
(4 marks)
3) Illustrate step by step how to run the merge sort on the following list' (4 marks)
1,32,12,19 r28,47,08,17
4

4) What is the Binarv Search algorithm? Explain using a suitable example. (4 marks)
s) Write down the algorithm to search an element in an array using binary search
(4 marks)
Total Marks: 2o

End of the PaPer--

6-;

You might also like