Umversity Lanka: Rajarata Faculty Applied
Umversity Lanka: Rajarata Faculty Applied
Instructions to candidates
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.
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
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.
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
6-;