Sorting based on partition of an array
Sorting algorithms more efficient than the one by transpositions exploit the divide and conquer principle.
Shellsort
Shellsort utilizes the near best cases behaviour of insertion sort. It partition the array and then sort the subarray using insertion sort. Then it make subarrays with smaller gap, meaning fewer and longer subarray.
read moreTransposition Sorting
Sorting by transposition
The simplest sorting algorithms use transposition to sort an array of data. Three major algorithms in this type are insertion sort, bubble sort, selection sort. I also write about heapsort that is an algothm that apply the principle behind the selection sort more efficiently. I will show sample implementations of these algorithms and then analyze the performances.
read moreStacks and imitating recursion
Stacks
Stack is a data structure that can perform a part of the operation that lists can. We can take only the last element appended to the stack. The operation taking out the element is called "pop", and appending the element is called "push". It sounds like there is no use for stacks, however, stacks can perform those operations more efficiently than lists. This is another kind of tradeoff we saw for lists. Analogous to lists, stacks can be implemented as array-based and linked-stack. And the implementations are quite simple.
read more