b'\n_START_ARTICLE_\nStrand sort\n_START_SECTION_\nAlgoritmo\n_START_PARAGRAPH_\nUma maneira simples de expressar o strand sort, em pseudoc\xc3\xb3digo \xc3\xa9 como se segue:_NEWLINE_procedure strandSort( A : list of sortable items ) defined as:_NEWLINE_  while length( A ) > 0_NEWLINE_    clear sublist_NEWLINE_    sublist[ 0 ] := A[ 0 ]_NEWLINE_    remove A[ 0 ]_NEWLINE_    for each i in 0 to length( A ) do:_NEWLINE_      if A[ i ] > sublist[ last ] then_NEWLINE_        append A[ i ] to sublist_NEWLINE_        remove A[ i ]_NEWLINE_      end if_NEWLINE_    end for_NEWLINE_    merge sublist into results_NEWLINE_  end while_NEWLINE_  return results_NEWLINE_end procedure\n_START_SECTION_\nImplementa\xc3\xa7\xc3\xa3o em Haskell\n_START_PARAGRAPH_\nmerge [] l = l_NEWLINE_merge l [] = l_NEWLINE_merge l1@(x1:r1) l2@(x2:r2) =_NEWLINE_    if x1 < x2 then x1:(merge r1 l2) else x2:(merge l1 r2)_NEWLINE_ _NEWLINE_ssort [] = []_NEWLINE_ssort l = merge strand (ssort rest)_NEWLINE_    where (strand, rest) = foldr extend ([],[]) l_NEWLINE_          extend x ([],r) = ([x],r)_NEWLINE_          extend x (s:ss,r) = if x <= s then (x:s:ss,r) else (s:ss,x:r)\n_START_SECTION_\nImplementa\xc3\xa7\xc3\xa3o em PHP\n_START_PARAGRAPH_\nfunction strandsort(array $arr) {_NEWLINE_  $result = array();_NEWLINE_  while (count($arr)) {_NEWLINE_    $sublist = array();_NEWLINE_    $sublist[] = array_shift($arr);_NEWLINE_    $last = count($sublist)-1;_NEWLINE_    foreach ($arr as $i => $val) {_NEWLINE_      if ($val > $sublist[$last]) {_NEWLINE_        $sublist[] = $val;_NEWLINE_        unset($arr[$i]);_NEWLINE_        $last++;_NEWLINE_      }_NEWLINE_    }_NEWLINE_ _NEWLINE_    if (!empty($result)) {_NEWLINE_      foreach ($sublist as $val) {_NEWLINE_        $spliced = false;_NEWLINE_        foreach ($result as $i => $rval) {_NEWLINE_          if ($val < $rval) {_NEWLINE_            array_splice($result, $i, 0, $val);_NEWLINE_            $spliced = true;_NEWLINE_            break;_NEWLINE_          }_NEWLINE_        }_NEWLINE_ _NEWLINE_        if (!$spliced) {_NEWLINE_          $result[] = $val;_NEWLINE_        }_NEWLINE_      }_NEWLINE_    }_NEWLINE_    else {_NEWLINE_      $result = $sublist;_NEWLINE_    }_NEWLINE_  }_NEWLINE_ _NEWLINE_  return $result;}'