Fundamentals of Datastructures and Algorithms (ICT 4303)
Fundamentals of Datastructures and Algorithms (ICT 4303)
Fundamentals of Datastructures and Algorithms (ICT 4303)
A
Answer all the questions.
Instructions to Candidates:
Answer ALL questions Missing data may be suitably assumed
1) For the given sequence of numbers, apply insertion sort technique to sort the numbers in an (5)
ascending order.Sequence: 18, 11, 12, 6, 36, 27
A)
B) Define adjacency matrix and adjacency list. For the graph in Figure Q1.B,find the adjacency matrix (3)
and adjacency list.
2) For the graph given in Figure Q2.A, show the traversal of the graph by Depth First Search. Show (5)
the steps of your work clearly.
A)
Page 1 of 3
B) Write the steps involved in the insertion and deletion of an element in the stack. (3)
C) What are the scenarios in which an element can be inserted into a circular queue? (2)
3) Write a function to find any given element in an array of numbers usingbinary search technique. (5)
What is the time complexity of this search? Show the steps to search for element 9 in the array of
A) numbers: 9,18, 21, 22,36, 72 using binary search technique.
B) Construct a binary search tree for the following elements: 11, 12, 6, 18, 1, 10. Show the stepwise (3)
process.
C) Convert the given prefix expression to postfix expression. Show the steps of your work. (2)
Expression: +A*BC
4) Consider the max heap given in Figure Q4.A. Show the steps when: (5)
B) Define linked list data structure. What is the primary advantage of a linked list? (3)
C) Write a code snippet to take input from the user and insert the elements in a two-dimensional array. (2)
5) Write a code snippet which inserts an element at the beginning and removes the last element in a (5)
doubly linked list.
A)
B) Define the different asymptotic notations used to measure time complexity of any algorithm. (3)
Page 2 of 3
C) Traverse the tree given in Figure Q5.C using inorder tree traversal technique. (2)
-----End-----
Page 3 of 3