src/Alg/Sort/Gnome.php
public static function sort( &$list )
	{
		$n	= count( $list );
		$i	= 0;
		while( $i < $n )
		{
			if( $i == 0 || $list[$i-1] <= $list[$i] )
				$i++;
			else
			{
				$tmp = $list[$i];
				$list[$i]	= $list[$i-1];
				$list[--$i] = $tmp;
			}
		}
	}
public static function sort( &$list )
	{
		$n	= count( $list );
		$i	= 0;
		while( $i < $n )
		{
			if( $i == 0 || $list[$i-1] <= $list[$i] )
				$i++;
			else
			{
				$tmp = $list[$i];
				$list[$i]	= $list[$i-1];
				$list[--$i] = $tmp;
			}
		}
	}
public static function sort ( & $ list ) { $ n = count ( $ list ) ; $ i = 0 ; while ( $ i < $ n ) { if ( $ i == 0 || $ list [ $ i - 1 ] <= $ list [ $ i ] ) $ i ++ ; else { $ tmp = $ list [ $ i ] ; $ list [ $ i ] = $ list [ $ i - 1 ] ; $ list [ -- $ i ] = $ tmp ; } } }
Sorts List in-place with Gnome Sort.
@access		public
@static
@param		array		$list		Reference of list to sort
Sorts List in - place with Gnome Sort .