Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Standard view
Full view
of .
0 of .
Results for:
P. 1
A Comparative Study on Kakkot Sort and Other Sorting Methods

# A Comparative Study on Kakkot Sort and Other Sorting Methods

Ratings: (0)|Views: 124 |Likes:
Several efficient algorithms were developed to cope with the popular task of sorting. Kakkot sort is a new variant of Quick and Insertion sort. The Kakkot sort algorithm requires O( n log n ) comparisons for worst case and average case. Typically, Kakkot Sort is significantly faster in practice than other O ( n log n ) algorithms , because its inner loop can be efficiently implemented on most architectures . This sorting method requires data movement, but less than that of insertion sort. This data movement can be reduced by implementing the algorithm using linked list. In this comparative study the mathematical results of Kakkot sort were verified experimentally on ten randomly generated unsorted numbers. To have some experimental data to sustain this comparison four different sorting methods were chosen and code was executed and execution time was noted to verify and analyze the performance. The Kakkot Sort algorithm performance was found better as compared to other sorting methods.
Several efficient algorithms were developed to cope with the popular task of sorting. Kakkot sort is a new variant of Quick and Insertion sort. The Kakkot sort algorithm requires O( n log n ) comparisons for worst case and average case. Typically, Kakkot Sort is significantly faster in practice than other O ( n log n ) algorithms , because its inner loop can be efficiently implemented on most architectures . This sorting method requires data movement, but less than that of insertion sort. This data movement can be reduced by implementing the algorithm using linked list. In this comparative study the mathematical results of Kakkot sort were verified experimentally on ten randomly generated unsorted numbers. To have some experimental data to sustain this comparison four different sorting methods were chosen and code was executed and execution time was noted to verify and analyze the performance. The Kakkot Sort algorithm performance was found better as compared to other sorting methods.

### Availability:

See more
See less

12/04/2010

pdf

text

original

A Comparative Study on Kakkot Sort and OtherSorting Methods
Rajesh Ramachandran
HOD, Department of Computer ScienceNaipunnya Institute of Management &Information Technology, Pongam, KeralaEmail:  ryanrajesh@hotmail.com
Dr.E.Kirubakaran
Sr.DGM(Outsourcing),BHEL,TrichyEmail:e_kiru@yahoo.com
Abstract:
Several efficient algorithms weredeveloped to cope with the popular task of sorting.
Kakkot sort
is a new variant of Quick and Insertion sort. The
Kakkot sort
algorithm requires O( n log n )comparisons for worst case and averagecase. Typically,
Kakkot Sort
IntroductionSorting
is any process of arranging items insome sequence and/or in different sets, andaccordingly, it has two common, yet distinctmeanings:1.ordering: arranging items of thesame kind, class, nature, etc. in someordered sequence,2. categorizing: grouping and labelingitems with similar properties together(by sorts).Incomputer science and mathematics, a
Sorting Algorithm
is an algorithm that putselements of a list in a certain order. Themost-used orders are numerical order andlexicographical order. Efficient sorting isimportant to optimizing the use of otheralgorithms (such as search and mergealgorithms) that require sorted lists to work correctly.Toanalyze an algorithm is to determine theamount of resources (such as time andstorage) necessary to execute it. Mostalgorithms are designed to work with inputsof arbitrary length. Usually the efficiency orcomplexity of an algorithm is stated as afunction relating the input length to thenumber of steps (time complexity) orstorage locations (space complexity).Algorithm analysis is an important part of abroader computational complexity theory,

which provides theoretical estimates for theresources needed by any algorithm whichsolves a given computational problem.These estimates provide an insight intoreasonable directions of search for efficientalgorithms. In theoretical analysis of algorithms it is common to estimate theircomplexity in the asymptotic sense, i.e., toestimate the complexity function forarbitrarily large input.Big O notation,omeganotation and theta notation are usedto this end
Time complexity
Time efficiency estimates depend on whatwe define to be a step. For the analysis tocorrespond usefully to the actual executiontime, the time required to perform a stepmust be guaranteed to be bounded above bya constant. In mathematics, computerscience, and related fields, Big Oh notationdescribes the limiting behavior of a functionwhen the argument tends towards aparticular value or infinity, usually in termsof simpler functions. Big O notation allowsits users to simplify functions in order toconcentrate on their growth rates: differentfunctions with the same growth rate may berepresented using the same O notation.Although developed as a part of puremathematics, this notation is now frequentlyalso used in computational complexitytheory to describe an algorithm's usage of computational resources: the worst case oraverage case running time or memory usageof an algorithm is often expressed as afunction of the length of its input using bigO notation.
Space complexity
The better the time complexity of analgorithm is, the faster the algorithm willcarry out his work in practice. Apart fromtime complexity, its space complexity is alsoimportant: This is essentially the number of memory cells which an algorithm needs. Agood algorithm keeps this number as smallas possible, too. The space complexity of aprogram (for a given input) is the number of elementary objects that this program needsto store during its execution. This number iscomputed with respect to the size n of theinput data.There is often a time-space-tradeoff involved in a problem, that is, it cannot besolved with few computing time and lowmemory consumption. One then has to makea compromise and to exchange computingtime for memory consumption or vice versa,depending on which algorithm one choosesand how one parameterizes it.In addition to varying complexity, sortingalgorithms also fall into two basic categories
comparison based and non-comparisonbased. A comparison based algorithm ordersa sorting array by weighing the value of oneelement against the value of other elements.Algorithms such as Quicksort, Mergesort,Heapsort, Bubble sort, and Insertion sort arecomparison based. Alternatively, a non-comparison based algorithm sorts an arraywithout consideration of pairwise dataelements. Radix sort is a non-comparisonbased algorithm that treats the sortingelements as numbers represented in a base-M number system, and then works withindividual digits of M.Another factor which influences theperformance of sorting method is thebehavior pattern of the input. In computerscience, best, worst and average cases of agiven algorithm express what the resourceusage is at least, at most and on average,respectively. Usually the resource beingconsidered is running time, but it could alsobe memory or other resources.
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 8, November 2010151 http://sites.google.com/site/ijcsis/ISSN 1947-5500

Kakkot SortKakkot Sort
is a sorting algorithm that ,makes O ( n log n ) (Big Oh notation)comparisons to sort n items. Typically,
Kakkot Sort
is significantly faster inpractice than other O ( n log n ) algorithms ,because its inner loop can be efficientlyimplemented on most architectures . Thissorting method requires data movement butless than that of insertion sort. This datamovement can be reduced by implementingthe algorithm using linked list. Majoradvantage of this sorting method is itsbehavior pattern is same for all cases, ietime complexity of this method is same forbest, average and worst case
How it sorts
From the given set of unsorted numbers,take the first two numbers and name it askey one and key two , ie, K1 and K2. Readall the remaining numbers one by one.Compare each number first with K2. If thenumber is greater than or equal to K2 thenplace the number right of K2 else comparethe same number with K1. If the number isgreater than K1 then place the numberimmediate right of K1 else left of K1.Conitnue the same process for all theremaining numbers in the list. Finally wewill get three sub lists. One with numbersless than or equal to K1, one with numbersgreater than or equal to  K2 and the otherwith numbers between K1 and K2. Repeatthe same process for each sub list. Continuethis process till the sub list contains zeroelements or one element.
AlgorithmKakkot Sort
(N:Array of Numbers, K1 ,K2 ,A:integers,)Step1. Read the first two numbers from N,Let K1 & K2Step2. Sort K1 and K2Step3. Read the next number, Let AStep4. Compare A with K2Step5. If  A is greater  than or equal to K2then place A right of K2elsecompare A with K1.If A is less than  K1then place A left of K1elsePlace A immediate right of  K1Step6 . If the  list contains any moreelements go to step 3Step 7.  Now we have 3 Sub list.
First list with all values lessthan or equal to K1.
Second with values betweenK1 and K2
Final with values greater thanor equal to K2.Step8. If each list contains more than 1element go to step1Step 9 End.
Time complexity
If there are ‘n’ numbers, then each iteration
needs maximum 2 * (n-2) comparison andminimum of n-2 comparison and plus one.So if we take the average it will be=(2n-4+n-2)/2 + 1=(3n-6)/2+1= 3n/2
2In the average case each list would have 3sub lists and number of iteration will be3
x
=ntaking logarithm on bothside we get
(IJCSIS) International Journal of Computer Science and Information Security,Vol. 8, No. 8, November 2010152 http://sites.google.com/site/ijcsis/ISSN 1947-5500