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
// Helper Constructor | |
var RandomArray = function(size) { | |
size = size || 10; | |
var tempArray = []; | |
for(var count=0,max = size;count<max;count++) { | |
tempArray.push(~~(Math.random()*100)); | |
} | |
return tempArray; | |
}; |
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 Node = function(value) { | |
this.value = value; | |
this.next=null; | |
return this; | |
}; | |
var LinkedList = function(node){ | |
this.head = node; | |
return this; | |
}; |
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 Node = function(value) { | |
this.value = value; | |
this.left = null; | |
this.right = null; | |
return this; | |
}; | |
Node.prototype.insert = function(newNode) { | |
if(newNode.value < this.value) { | |
if(this.left === null) { |
NewerOlder