bitween/merge-sort

There is no license information available for the latest version (dev-master) of this package.

A simple example of a divide and conquer algorithm: merge sort. Example is used to explain the divide and conquer technique.

dev-master 2021-02-15 13:50 UTC

This package is auto-updated.

Last update: 2024-05-22 19:53:55 UTC


README

This is a simple example a divide-and-conquer algorithm. It uses the Merge sort algorithm as an example. Using this algorithm in PHP is fairly simple:

    $mergeSort = new Bitween\MergeSort();
    $sortedArray = $mergeSort->sort([ 3, 2, 1]);

    echo $sortedArray === [ 1, 2, 3 ]; // true