Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

Reg.

No: Final / Assessment Spring 2021 Name: -

Program: BSCS Class & Section: 3


Course Code & Title: CSC2102 Data structures and Algorithms Duration: 2.0 hours
Instructor’s Name: Arfaa Asaf Total Marks: Thirty
(30)
Date: - June 2021 Submission Mode: Online
IMPORTANT instructions:

Read carefully the question first, and then ask for the queries.

 Student are required to Submit/turn in their Assessments on Google classroom only, Assessment
submitted through any other Mode will not be considered submitted and will not be marked.
 Student are Required to attempt the assessment in a word file.
 The name of file must include student registration No and Name.
 Copy pasted Answers may result in zero marks for the question.
___________________________________________________________________________
____________________
‘Attempt all questions’

Theoretical/Descriptive: (5 *3 =15 marks)

1. Find a Spanning tree from the given using Breadth First Search. Provide the out degree of the given graph.

2. Assume that you are have to store that data of books in an organized way. More books should be
added one side and removed from the other side of the shelf. Determine and mention the suitable data
structure for this situation .Provide the list of operations performed using the opted data structure.
Discuss whether the implementation of the data structure is static, dynamic or both.

3. Consider all the digits of your roll number. Update each number by adding 3 in each digit.
Demonstrate what happens when you insert the updated values in a hash table with collisions resolved
by Linear probing. Let the table have 9 slots. Provide hash function as well.

Scenario: (7.5*2= 15 marks)


4. Assume you have to lead a camping team of students. Students have been assigned some identities
randomly. The identities are numeric values which are given below. Create an AVL(step by step) for the
following numbers. Traverse the created binary tree using “pre order” traversal method and write the out
put. Provide the complete function for pre-order traversal as well.

62, 8, 19, 26, 17, 107, 98, 80

Sort the above numbers using insertion sort (step by step) and discuss about its complexity as well.

5. Consider A, B, C, D, E and F are six different tourism places in Lahore. Here we are assuming that
you are availing “Careem” facility in order to cover the distance and visit various places. Let’s assume
that your starting point is A, find the shortest routes to other places of Islamabad using such an
algorithm that only accepts positive values of weight after completing the given graph by replacing x
with the third last digit of your roll number, y with the second last digit and z with the last digit of your
roll number. If the digit is zero, the add 2 in it and the update the graph. Moreover create a graph from
the given contingency matrix.

You might also like