Tuesday, January 31, 2012

Introsort implementation by Groovy.

Another groovy homework. this time Introsort.

From Wikipedia :
Introsort or introspective sort is a sorting algorithm designed by David Musser in 1997. It begins with quicksort and switches to heapsort when the recursion depth exceeds a level based on (the logarithm of) the number of elements being sorted. It is the best of both worlds, with a worst-case O(n log n) runtime and practical performance comparable to quicksort on typical data sets. Since both algorithms it uses are comparison sorts, it too is a comparison sort.

Friday, January 27, 2012

Log base 2 of an N-bit integer

Another Groovy training post. This time, three different method to find log base 2 of an N-bit integer.

Note: All algorithms and code credits goes to Bit Twiddling Hacks.





Note: All algorithms and code credits goes to Bit Twiddling Hacks.

Sunday, January 22, 2012

Priority Queue - Groovy Implementation

Here it is :), Another data structure, implemented by me in Groovy as part of my Groovy learning practices. Priority Queue.

Tuesday, January 10, 2012