MatrixBerryCore
Namespaces | Functions
mxberry::core::sort Namespace Reference

Namespaces

 test
 

Functions

function mergesort (in x)
 Syntax: sx = mergesort(x);. More...
 
function mergesorti (in x, in ll, in uu, in kk)
 Sort x(ll:uu) via merge sort Note: In practice, x xhould be passed by reference. More...
 
function insertionsorti (in x, in ll, in uu)
 Sort x(ll:uu) via insertion sort Note: In practice, x xhould be passed by reference. More...
 
function merge (in x, in ll, in mm, in uu)
 Combine sorted arrays x(ll:mm) and x((mm + 1):uu) Note: In practice, x xhould be passed by reference. More...
 

Function Documentation

◆ insertionsorti()

function mxberry::core::sort::insertionsorti ( in  x,
in  ll,
in  uu 
)

Sort x(ll:uu) via insertion sort Note: In practice, x xhould be passed by reference.

◆ merge()

function mxberry::core::sort::merge ( in  x,
in  ll,
in  mm,
in  uu 
)

Combine sorted arrays x(ll:mm) and x((mm + 1):uu) Note: In practice, x xhould be passed by reference.

◆ mergesort()

function mxberry::core::sort::mergesort ( in  x)

Syntax: sx = mergesort(x);.

*  Inputs:       x is a vector of length n
* 
*  Outputs:      sx is the sorted (ascending) version of x
* 
*  Description:  This function sorts the input array x in ascending order
*                using the mergesort algorithm
* 
*  Complexity:   O(n * log(n))    best-case performance
*                O(n * log(n))    average-case performance
*                O(n * log(n))    worst-case performance
*                O(n)             auxiliary space
* 
*  Author:       Brian Moore
*                brimoor@umich.edu
* 
*  Date:         January 5, 2014
* 
*  Author:       Peter Gagarinov, PhD
*                pgagarinov@gmail.com
* 
*  Date:         August 5, 2016
* 

◆ mergesorti()

function mxberry::core::sort::mergesorti ( in  x,
in  ll,
in  uu,
in  kk 
)

Sort x(ll:uu) via merge sort Note: In practice, x xhould be passed by reference.