





Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This lecture is part of lecture series for Design and Analysis of Algorithms course. This course was taught by Dr. Bhaskar Sanyal at Maulana Azad National Institute of Technology. It includes: Radix, Sort, Algorithm, Classification, Comparison, Base, Number, Distribution, Keys, Significant, Digit, Recursive
Typology: Slides
1 / 9
This page cannot be seen from the preview
Don't miss anything!






1
2
For typical sorting algorithms acceptable/good behavior is O( behavior is Ω( n^ 2). n log n ) and unacceptable/bad Ideal behavior for a sort is O( n ).
Some sorting algorithms are “in place", such that only O(1) or O(logbeyond the items being sorted. n ) memory is needed Others need to create auxiliary data structures for data to be temporarily stored. We‟ve seenin class that mergesort needs more memory resources as it is not an “in place” algorithm, while quicksort and heapsort are “in place”. Radix and bucket sorts are not “in place”.
Methods used internally include insertion, exchange, selection, merging, distribution etc. Bubble sort and quicksort are exchange sorts. Heapsort is a selection sort.
4
It distributes each item to a bucket according to part of the item's key. After each pass, items are collected from the buckets, keeping the items in order, thenredistributed according to the next most significant part of the key.
5
If we are sorting strings, we would create a bucket for „a‟,‟b‟,‟c‟ upto „z‟. After the first pass, strings are roughly sorted in that any two strings that begin with different letters are in the correct order. If a bucket has more than one string, its elements are recursively sorted (sorting into bucketsby the next most significant character). Contents of buckets are concatenated.
In MSD, if we know the minimum number of characters needed to distinguish all the strings,we can only sort these number of characters. So, if the strings are long, but we can distinguish them all by just looking at the first three characters, then we can sort 3 instead ofthe length of the keys.
7
0 1 2 3 4 5 6 7 8 9
8
0 1 2 3 4 5 6 7 8 9 08 50 77 87