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

Week 7-Tutorial

The document discusses a homework assignment on sorting algorithms. It provides an example of applying heapsort to a string and asks students to match sorting algorithms to real-world applications based on factors like speed, memory usage, and data size.

Uploaded by

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

Week 7-Tutorial

The document discusses a homework assignment on sorting algorithms. It provides an example of applying heapsort to a string and asks students to match sorting algorithms to real-world applications based on factors like speed, memory usage, and data size.

Uploaded by

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

Week 7

Sunil Tripathi
K200295

Again similar to Week 5 or 6.

Use Set 24 Priority Queues slides 39-52 and act out Set 24 DemoHeapsort

Q.1 Consider the data PRACTISEHEAP, build a max heap and then apply heapsort.

Homework Exercises

1. Slide 52 provides a useful summary of the different sorting algorithms.


For each algorithm, provide an application from real life for which you think the
algorithm might be the most suitable sort for that application. Consider, the speed of
the algorithm, the space the algorithm requires, stability, the size of the data in the
problem, the speed of your computer, etc.

Answers
Sorting algorithm Application

Selection sort Sorting flash cards

Sorting for short lists, 30 people weights


Insertion sort
It is not that much related to real world. It
Shell sort makes advantages because it does not use
additional memory. So, the cases where an
additional memory not available, shell sort
is a good answer.

Merge sort For e-commerce applications


Timsort It is based on insertion sort and merge sort,
so the applications for e-commerce Tim
sort is good choice
Quicksort It does not need additional memory;
commercial applications use quick sort.
Heap sort Real time embedded systems where less
space available.

You might also like