This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var book = { | |
title : 'The hidden Universe', | |
author: 'Konstantin', | |
printPage : function(){ | |
console.log('printing book page'); | |
}, | |
editions: ['1', '2', '3'], | |
translators : [ | |
{ | |
publisher: 'Unipub A', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var book = { | |
title : 'The hidden Universe', | |
author: 'Konstantin', | |
publishDate: 'Jan 1 2016', | |
pageCount: 300 | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function HeapSort(arr) { | |
console.log('Heap Sort Intialized!') | |
this.items = arr; | |
} | |
HeapSort.prototype = { | |
//swap items in array | |
swap: function(index_one, index_two) { | |
//swap | |
var temp = this.items[index_one]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MinHeap(heap_size) { | |
//initialize parent class passing in heap size | |
Heap.call(this, heap_size); | |
//sub class of Head | |
console.log('Minheap Initialized!') | |
} | |
//setup the prototypal inheritance change so MinHeap can inherit from Heap | |
MinHeap.prototype = Object.create(Heap.prototype); | |
//Setup constructure of MinHeap to be itself instead of something else | |
MinHeap.prototype.constructor = MinHeap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MaxHeap(heap_size) { | |
//initialize parent class passing in heap size | |
Heap.call(this, heap_size); | |
//sub class of Head | |
console.log('Maxheap Initialized!') | |
} | |
//setup the prototypal inheritance change so Maxheap can inherit from Heap | |
MaxHeap.prototype = Object.create(Heap.prototype); | |
//Setup constructure of Maxheap to be itself instead of something else | |
MaxHeap.prototype.constructor = MaxHeap; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Heap(size) { | |
this.MAX_SIZE = size; | |
this.items = new Array(size); | |
this.count = 0; | |
} | |
Heap.prototype = { | |
//swap items in array | |
swap: function(index_one, index_two) { | |
//console.log('swapping ' + index_one + ' with ' + index_two); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScriptoniteSort() { | |
this.arr = []; | |
} | |
ScriptoniteSort.prototype = { | |
swap: function(arr, index_one, index_two) { | |
//swap | |
var temp = arr[index_one]; | |
arr[index_one] = arr[index_two]; | |
arr[index_two] = temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScriptoniteSort() { | |
this.arr = []; | |
} | |
ScriptoniteSort.prototype = { | |
/* | |
other code goes here | |
*/ | |
//split the datalist recursively | |
mergeSplit: function(datalist) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScriptoniteSort() { | |
this.arr = []; | |
} | |
ScriptoniteSort.prototype = { | |
swap: function(arr, index_one, index_two) { | |
//swap | |
var temp = arr[index_one]; | |
arr[index_one] = arr[index_two]; | |
arr[index_two] = temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ScriptoniteSort() { | |
this.arr = []; | |
} | |
ScriptoniteSort.prototype = { | |
swap: function(arr, index_one, index_two) { | |
//swap | |
var temp = arr[index_one]; | |
arr[index_one] = arr[index_two]; | |
arr[index_two] = temp; |