Category: Sort

Algorithm Heap Sort

Heap Sort algorithm: Swift & Objective-C implementations

Heap sort algorithm is sorting algorithm that uses a data structure called heap. A Heap is a data structure similar to a binary tree (nearly completed) saved into an array. Heap Sort runs in O(n lg n) time. The main property of a heap is that it must maintain the Heap-Property. The Heap-Property depends on the

Read More
Algorithm_ Merge Sort

Merge Sort algorithm: Swift & Objective-C implementations

Merge Sort algorithm is one of the most common algorithms in books. It is the most used example to explain the divide and conquer technique. Furthermore, it is one of the easiest algorithms that has a reasonable running time for a big input => O(n log n). How Merge Sort algorithm works? This graph shows the process: If you

Read More
Algorithm Insertion Sort Objective -C Swift

Insertion Sort algorithm: Swift & Objective-C implementations

When one is starting to learn about algorithms, one of the first examples is Insertion Sort algorithm. The classic example to introduce Insertion Sort algorithm is how a poker player sorts a hand of cards in increasing order: Every time he gets a new card from the deck, he compares it to the cards which are already

Read More