0% found this document useful (0 votes)
34 views1 page

ASSIGNMENT-3 Searching and Sorting

Uploaded by

ashvendra71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

ASSIGNMENT-3 Searching and Sorting

Uploaded by

ashvendra71
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

ASSIGNMENT –3

Subject: Data Structure Subject code: BCS-301


Faculty Name: Session: 2024-25 (ODD)
Section: All Submission Date:

1. Apply the merge sort algorithm to sort the following elements in ascending order. 13, 16,
10, 11, 4, 12, 6, 7. Discuss the time and space complexity of merge sort?
(BCS-301.2, K3)

2. Apply the quick sort algorithm to sort 15, 22, 30, 10, 15, 64, 1, 3, 9, 2. Is it a stable
sorting? Justify. (BCS-301.2, K3)

3. Write heap sort algorithm. Analyze the running time of your algorithm.
(BCS-301.2, K3)
4. The keys 12, 17, 13, 2, 5, 43, 5 and 15 are inserted into an initially empty hash table of
length 15 using open addressing with hash function h(k)=k mod 10 and linear probing.
Show the resultant hash table? (BCS-301.2, K3)

5. Using the bubble sort algorithm, find the number of swaps (interchange) required to sort:
5, 10, 15, 55, 45, 35, 60, 75, 70. (BCS-301.2, K3)

6. Write algorithm of insertion sort. Implement the same on the following numbers; also
calculate its time complexity. 13, 16, 10, 11, 4, 12, 6,7. (BCS-301.2, K3)
7. Explain the following as a short note: (BCS-301.2, K2)
a) Internal sorting vs external sorting with example.
b) Stable sorting vs Unstable sorting with example?
c) in-place sorting vs out-place sorting with example?

8. Given input {4371, 1323, 6173, 4199, 4344, 9679, 1989} and a hash function h(X) = X
(mod 10). Calculate the memory location of each key and set them at the memory from 1
to 10. (BCS-301.2, K3)
i. Hash table with using linear probing and
ii. Hash table with quadratic probing.
iii. Hash table with second hash function h2 (x) = 7 − (x mod 7).

You might also like