quick sort – sorting algorithm – library MetaTrader 5

quick sort - sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                    QuickSort.mq5 | //|                                    2019-2020, dimitri pecheritsa | //|                                                 792112@gmail.com | //+——————————————————————+ // //   quick sort – sorting algorithm // //   quick sort is a highly efficient sorting algorithm and is based //on partitioning of array of data into smaller arrays //   a large array is partitioned into two arrays one of which holds //values smaller … Read more

merge sort – a merging method comparison-based sorting algorithm – library MetaTrader 5

merge sort - a merging method comparison-based sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                    MergeSort.mq5 | //|                                    2019-2020, dimitri pecheritsa | //|                                                 792112@gmail.com | //+——————————————————————+ //   merge sort – a merging method comparison-based sorting algorithm // //   merge sort is an efficient, general-purpose, comparison-based //sorting algorithm. most implementations produce a stable sort, //which means that the order of equal elements is the same in the //input and output. merge … Read more

heap sort – array sorting algorithm – library MetaTrader 5

heap sort - array sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                     HeapSort.mq5 | //|                                  2019 – 2021, dimitri pecheritsa | //|                             https://www.mql5.com/en/users/dmipec | //+——————————————————————+ //+——————————————————————+ //| heap sort – array sorting algorithm                              | //|  best – n log n, average – n log n, worst – n log n              | //|  memory – 1, stable – no, method – selection                     | //|  heapsort is a much more efficient version of … Read more

shell sort – array sorting algorithm – library MetaTrader 5

shell sort - array sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                    ShellSort.mq5 | //|                                    2019-2021, dimitri pecheritsa | //|                                         mql5.com/en/users/dmipec | //+——————————————————————+ //+——————————————————————+ //| shell sort – array sorting algorithm                             | //|  cases: best: n log n, average: n^(4/3), worst: n^(3/2)          | //|  memory: 1, stable: no, method: insertion                        | //|  note: small code size                                           | //+——————————————————————+ //+——————————————————————+ //|  shellsort, also known as shell sort or shell’s method, is an    | //|in-place comparison … Read more

selection sort – array sorting algorithm – library MetaTrader 5

selection sort - array sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                SelectionSort.mq5 | //|                                    2019-2021, dimitri pecheritsa | //|                                         mql5.com/en/users/dmipec | //+——————————————————————+ //| selection sort – array sorting algorithm                         | //+——————————————————————+ //|  best: n^2, average: n^2, worst: n^2                             | //|  memory: 1, stable: no, method: selection                        | //|  note: stable with o(n) extra space or when using linked lists.  | //+——————————————————————+ //|  in computer science, selection sort is an in-place comparison   | … Read more

insertion sort – array sorting algorithm – library MetaTrader 5

insertion sort - array sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                InsertionSort.mq5 | //|                                    2019-2021, dimitri pecheritsa | //|                                         mql5.com/en/users/dmipec | //|——————————————————————| //| cls | insertion sort                                             | //|——————————————————————| //| use | array sorting algorithm                                    | //|  best: n; average: n^2; worst: n^2                               | //|  memory: 1; stable: yes; method: insertion                       | //|  note: o(n + d), in the worst case over sequences that have d    | //|inversions.                                                       | //|——————————————————————| //|  insertion … Read more

gnome sort – array sorting algorithm – library MetaTrader 5

gnome sort - array sorting algorithm - library for MetaTrader 5
//+——————————————————————+ //|                                                    GnomeSort.mq5 | //|                                    2019-2021, dimitri pecheritsa | //|                                         mql5.com/en/users/dmipec | //|——————————————————————| //|  c  | gnome sort                                                 | //|——————————————————————| //| use | array sorting algorithm                                    | //|  best: n; average: n^2; worst: n^2                               | //|  memory: 1; stable: yes; method: exchanging                      | //|  note: tiny code size                                            | //|  originally proposed by iranian computer scientist hamid         | //|sarbazi-azad (professor of computer science and engineering at    | … Read more

Radix sort (The fastest numeric sort) – library MetaTrader 5

Radix sort (The fastest numeric sort) - library for MetaTrader 5
RadixSort Algorithm RadixSort sorts numeric data (integers or float) by considering a string of numbers where digit by digit sort starting from least significant digit position to most significant digit position. The algorithm is better explained on that Wikipedia page https://en.wikipedia.org/wiki/Radix_sort Time Complexity and Performance Radix sort has linear time complexity, it operates in O(n … Read more

Introsort (Introspective sort) – library MetaTrader 5

Introsort (Introspective sort) - library for MetaTrader 5
Introspective SortIntro or Introspective sort is a hybrid sorting algorithm that provide fast performance. It is a comparison based sorting algorithm based on three phases. It uses the quicksort sort along with heapsort and insertion-sort algorithms.  Quick Sort Quick sort is a divide and conquer algorithm which works by selecting a pivot element in the … Read more