Nodejs Utililty Methods Array Shell Sort

List of utility methods to do Array Shell Sort

Description

The list of methods to do Array Shell Sort are organized into topic(s).

Method

shellSort()
Array.prototype.shellSort= function() {
  var j, gap; 
  var n = this.length; 
    for (gap = n / 2; gap > 0; gap /= 2)  
        for (j = gap; j < n; j++)
            if (this[j] < this[j - gap])
                var temp = this[j];  
                var k = j - gap;  
...
shellSort()
Array.prototype.shellSort = function () {
  var gap, i, j;
  var temp;
  for (gap = this.length >> 1; gap > 0; gap >>= 1) {
    for (i = gap; i < this.length; i++) {
      temp = this[i];
      for (j = i - gap; j >= 0 && this[j] > temp; j -= gap) {
        this[j + gap] = this[j];
      this[j + gap] = temp;
};
shellSort()
Array.prototype.shellSort = function(){
  var temp,len = this.length;
  for(var increment = Math.floor(len/2);increment > 0;increment = Math.floor(increment/2)){
    for(var i = increment;i < len;i++){
      for(var j = i - increment;j >= 0&&this[j] > this[j + increment];j -= increment){
        temp = this[j];
        this[j] = this[j+increment];
        this[j+increment] = temp;
  return this;
shellSort()
Array.prototype.shellSort = function() {
    this.procedures = []
    var l = this.length
    var compare = 0
    var exchange = 0
    var comparet = Math.sqrt(l * l * l)
    var exchanget = '?'
    var list = [0, 1, 5, 19, 41, 109, 209, 505, 929, 2161, 3905, 8929, 16001, 36289, 64769, 146305, 260609]
    var listnum = 1
...
shellSort()
Array.prototype.shellSort = function () {
    for (var step = parseInt(this.length)/2; step > 0; step--) {
        for(var i = 0; i < step; i++) {
            for (var j = step+i; j < this.length; j += step) {
                var k = j, value = this[k];
                while(k >= step && value < this[k-step]){
                    this[k] = this[k-step];
                    k -= step;
                this[k] = value;
};
shellSort2()
Array.prototype.shellSort2 = function() {
    var l = this.length
    var compare = 0
    var exchange = 0
    var comparet = Math.sqrt(l * l * l)
    var exchanget = '?'
    var h = 128
    while (h < l / 2) h = 2 * h + 1
    while (h >= 1) {
...
shellSortBy(key)
Array.prototype.shellSortBy = function(key) {
    function more(a, b) {
        if (a > b) {
            return true
        } else {
            return false
    function exch(a, i, j) {
...