You are on page 1of 1

INDIAN INSTITUTE OF TECHNOLOGY ROORKEE

Data Structures and Algorithms (CSE-101)


Tutorial 3 Spring 23-24

Note:
1) We are not interested in actual code in any particular language but would be great if you are
writing in one.
2) Make sure to handle edge cases if any.
3) Make sure you put assumptions wherever taken.

Q1. Code to Reverse an array in-place.


Q2. Bubble Sort, Insertion, and Merge Sort
a) Pseudo Code, Time Complexity (best, average and worst)
b) Run on [32, 41, 17, 8, 41] step by step.
Q3. We have a linked list, complete below functions –
a) def pairwise_swapping_ll(self):
6-7-8-3-2
o/p: 7-6-3-8-2
b) def middle_elemet_ll(self):
6-7-8-3-2
o/p: 8
Q4. Write a pseudo code of implementing a dynamic array using a static array?
Q.5 Suppose you are given two sorted lists containing P and Q nodes respectively. Write
pseudocode to merge both list and return the merge list, remember the merge procedure of
merge sort?
Input:

a:5->10->15
b:2->3->20
Output: 2->3->5->10->15->20

Q.6 Write all steps to sort the elements using Quick sort algorithm.
44, 11, 77, 90, 40, 99, 88

You might also like