Sorts array of DOM elements by its depth in DOM tree.
@param {HTMLElement[]} arr - array to sort.
@param {boolean} descending - order of sort.
186862
function sortByDepth(arr, descending) {
    arr.sort(function (a, b) {
        return dom(descending ? b : a).parents().length - dom(descending ? a : b).parents().length;
    });
}
235888
function sortChildren(parent, sortingFunction) {
  if (!parent.children) return;
  parent.children = new Map([...parent.children.entries()].sort(sortingFunction));
  for (var i = 0; i < parent.children.length; ++i)
    recalculateSiblings(parent.children[i], i);
  for (var child of parent.children.values())
    sortChildren(child, sortingFunction);
}
1117047
function treeSorter(node) {
    if(node[options.childsProp]) {
      node[options.childsProp].forEach(function(node) {
        treeSorter(node);
      });
      node[options.childsProp].sort(function childSorter(a, b) {
        var result;
        if('undefined' === typeof a[options.sortProp]) {
          result = (options.sortDesc ? 1 : -1);
        } else if('undefined' === typeof b[options.sortProp]) {
          result = (options.sortDesc ? -1 : 1);
        } else {
          result = a[options.sortProp] > b[options.sortProp] ?
            (options.sortDesc ? -1 : 1) : (options.sortDesc ? 1 : -1);
        }
        return result;
      });
    }
  }
299309
public static <E extends Comparable<E>> void sortDescending(E[] intArray) {
        Quicksort.sort(intArray, 0, intArray.length - 1 , true);
    }
315718
public static void bucketSort( int[] arr, int m )
    {
        int[] count = new int[m];
        int j, i = 0;
        //System.out.println(count[0]==0?"true":"false");
        for ( j = 0; j < arr.length; j++ ) {
            count[ arr[j] ]++;
        }
        
        //loop and filter the elements
        for ( j = 0; j < m; j++ ) {
            if ( count[j] > 0 ) {
                while ( count[j]-- > 0 ) {
                    arr[i++] = j;
                }
            }
        }
    }
298637
function orderBy(array, sortPredicate, reverseOrder) {
  if (!isArrayLike(array)) {
    return array;
  }
  sortPredicate = isArray(sortPredicate) ? sortPredicate : [sortPredicate];
  if (sortPredicate.length === 0) { sortPredicate = ['+']; }
  sortPredicate = sortPredicate.map(function(predicate) {
    var descending = false;
    var get = predicate || value;
    if (isString(predicate)) {
      if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
        descending = predicate.charAt(0) == '-';
        predicate = predicate.substring(1);
      }
      if (predicate === '') {
        // Effectively no predicate was passed so we compare identity
        return reverseComparator(function(a, b) {
          return compare(a, b);
        }, descending);
      }
      get = $parse(predicate);
      if (get.constant) {
        var key = get();
        return reverseComparator(function(a, b) {
          return compare(a[key], b[key]);
        }, descending);
      }
    }
    return reverseComparator(function(a, b) {
      return compare(get(a),get(b));
    }, descending);
  });
  var arrayCopy = [];
  for (var i = 0; i < array.length; i++) { arrayCopy.push(array[i]); }
  return arrayCopy.sort(reverseComparator(comparator, reverseOrder));

  function comparator(o1, o2) {
    for (var i = 0; i < sortPredicate.length; i++) {
      var comp = sortPredicate[i](o1, o2);
      if (comp !== 0) break;
    }
    return comp;
  }
  function reverseComparator(comp, descending) {
    return descending
      ? function(a, b) {return comp(b,a);}
      : comp;
  }
  function compare(v1, v2) {
    var t1 = typeof v1;
    var t2 = typeof v2;
    if (t1 == t2) {
      if (isDate(v1) && isDate(v2)) {
        v1 = v1.valueOf();
        v2 = v2.valueOf();
      }
      if (t1 == "string") {
        v1 = v1.toLowerCase();
        v2 = v2.toLowerCase();
      }
      if (v1 === v2) return 0;
      return v1 < v2 ? -1 : 1;
    } else {
      return t1 < t2 ? -1 : 1;
    }
  }
}
1212855
public static void sortDescending(char[] charArray) {
        int index = 0;
        char value = 0;
        
        for(int i = 1; i < charArray.length; i++) {
            index = i;
            value = charArray[index];
            
            while(index > 0 && value > charArray[index - 1]) {
                charArray[index] = charArray[index - 1];
                
                index--;
            }
            
            charArray[index] = value;
        }
    }
1345631
function traverseArray(arr, strict) {
  arr.forEach(function(value, index) {
    arr[index] = traverse(value, strict);
  });
  return arr;
}
1094634
function arrset(arr, type) {
      if (arr == null) return null;
      if (typeof arr == 'string') {
        var f = umecob[type](arr);
        if (!f || typeof f != 'function') return null;
        return [f];
      }
      if (arr instanceof Array) {
        var l = arr.length;
        if (l == 0) return [];
        var ret = [];
        for (var i=0; i < l; i++) {
          var f = umecob[type]( arr[i] );
          if (f && typeof f == 'function') ret.push(f);
        }
        return ret;
      }
      return null;
    }
757926
public static <E extends Comparable<E>> void sortDescending(E[] array) {
        while(!Sort.isReverseSorted(array)) {
            FYShuffle.shuffle(array);
        }
    }
969274
function sortBy(tree, propertyName) {
    var _this = this;

    // It is needed an array structure to sort.
    if (!_.isArray(tree)) tree = [tree];
    tree.forEach(function (item) {
      return _(item).keys().forEach(function (key) {
        if (_.isArray(item[key])) item[key] = _this.sortBy(item[key], propertyName);
      });
    });
    return _.sortBy(tree, propertyName);
  }
708951
function stabilize(comparator, descending, arr1, arr2) { // eslint-disable-line no-shadow
    var x = arr1[0];
    var y = arr2[0];

    if (x === y) {
        x = descending ? arr2[1] : arr1[1];
        y = descending ? arr1[1] : arr2[1];
    } else {
        if (y === null) {
            return -1;
        }
        if (x === null) {
            return 1;
        }
    }

    return comparator(x, y);
}
598544
public function sortArrayByColumn(&$arr, $col)
    {
        $newArray = [];
        $sort_col = array();
        foreach ($arr as $key => $row) {
            $sort_col[$key] = strtoupper($row[$col]);
        }
        asort($sort_col, SORT_LOCALE_STRING);

        foreach ($sort_col as $key => $val) {
            $newArray[$key] = $arr[$key];
        }

        $arr = $newArray;
    }
391083
public static void sortDescending(int[] intArray) {
        boolean swapped = true;
        
        while(swapped) {
            swapped = false;
            
            for(int i = 0; i < (intArray.length - 1 ); i++) {
                if(intArray[i] < intArray[i + 1]) {
                    TrivialSwap.swap(intArray, i, i + 1);
                    
                    swapped = true;
                }
            }            
        }
    }
804342
function arraySort (arr, iterate, context, STR_UNDEFINED) {
  if (arr) {
    if (iterate === STR_UNDEFINED) {
      return toArray(arr).sort(sortByDef)
    }
    var compares
    var list = arrayMap(arr, function (item) {
      return { data: item }
    })
    var sortPros = getSortPros(arr, list, iterate, context || this)
    var len = sortPros.length
    if (len) {
      while (len >= 0) {
        compares = sortMultis(len, compares)
        len--
      }
      list = list.sort(compares)
    }
    return arrayMap(list, baseExports.property('data'))
  }
  return []
}
892370
def sort_array
      if @data.sorted_by
        @data.sorted_by.inject([]) do |memo, (key, value)|
          memo << [@data.columns.index(key), value == 'descending' ? 1 : 0]
        end
      end
    end
969064
function orderByDescending(expression) {

        //Check arguments
        if (!expression)
            throw new Error("Expression is invalid");
			
		//Use "orderBy" method
		var ordered = jslinq(this.items)
			.orderBy(expression)
			.toList();
		
		//Reverse order of array
		var outData = ordered.reverse();

        //Return for chaining
        return new jslinq(outData);
    }