DS model QP and key
DS model QP and key
sort
Course Outcome 6(CO6): Design a reservation system for railways that include
waiting list. If the reservation is ful "Display reservation full" and put the passenger in
in waiting list and give a waiting list number. If a passenger cancels the ticket. then the
seat should be automatically allocated to the first passenger in the waitiny list.
QP CODE: PAGES:3
Reg No:
Name:
APJ ABDUL KALAM TECHNOLOGICAL UNIVERSITY THIRD SEMESTER B.TECH
DEGREE EXAMINATION, MONTH &YEAR
PART A
. Calculate the frequency couni of the statcmcnt x = ^Ti; in the following code scgment
for (i = 0: I< n: i )
2 4 5 6 7 89 10 11 1 2 13 14 15
A B C D E F G
B D
E F G
9. Write an
algorithm to numbers in
arrange n
order. nonincreas1ng
0. Let the size of a hash table
is 10. The index of the hash
the keys 73, 54. 15, table varies from 0 to 9.
48, 89, 6, 37, 18, 41, 22, 62 are Assume
Show how the keys are
mapped
distributed using chaining method. using modulo operator.
Part B
Answer any one Question from each module. Fach question carries 14 Marks
OR
12 a) Write algorithms for Lincar Search and Binary Scarch and Compare their time
complexities (10)
b) Between O(nlogn) and Ologn) which one is better and why? 4)
13 a) Wnte algorithms to insert and delete elements from a double ended queue
15 a) Write an algor1thm to mult1pl, two poly nomials represented using l1nked list
10)
b)How doubly l1nked ist can be uscd to find palindromes 4
OR
I6 a) How is
memory compaction ( de-allocation) done in
memory management
b) Discuss the advantages and d1sadv antages ot First-fit. Best-fit and Worst-fit allocataon
schemcs
17. a) List the properties of Binary Search Trec. Write an algorithm to search an element
OR
18. a) Give algorithms for DFS and BFS of a graph and explain with examples (8)
19. a) Write algorithms for Merge sort and Quick Sort. (10)
b) Illustrate the working of Quick sort on the following input 38, 8, 0, 28, 45, -12, 89, 66,
42 4)
OR
20. a) With examples discuss the different hash functions used for hashing (10)
Teaching Plan
T hour
1. System Life Cycle,
I hour
1.2 Algorithms, Performance Analysis
hour
1.3 Space Complexity. Time Complexity
I hour
1.4 Asymptotic Notation (Big O Notation)
Ihour
I.5 Complexity Calculation of Simple Algorithms
Module 2 :Arrays and Searching (10 hours)
1 hour
2.1 Polynomial representation using Arays
l hour
2.2 Sparse matrix (Lecture 1)
hour
2.3 Sparse matrix (Lecture 2)