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
class Node { | |
// stores given value and points to nothing | |
constructor (value) { | |
this.value = value | |
this.next = null | |
} | |
} | |
class LinkedList { | |
// initial size is 0 and initially just has a head node that stores nothing and points to nothing |
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
class Item { | |
// stores given value and points to nothing | |
constructor (value) { | |
this.value = value | |
this.next = null | |
} | |
} | |
class Stack { | |
// initial size is 0 and initially just has a head node that stores nothing and points to nothing |
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
class Item { | |
// stores given value and points to nothing | |
constructor (value) { | |
this.value = value | |
this.next = null | |
} | |
} | |
class Queue { | |
// initial size is 0 and initially just has two reference items that store nothing and point to nothing |
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
class Node { | |
// stores given value and points to nothing | |
constructor (value) { | |
this.value = value | |
this.left = null | |
this.right = null | |
} | |
} | |
class Tree { |
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
class MinHeap { | |
// creates an array of given length | |
constructor(length) { | |
this.data = new Array(length) | |
this.size = 0 | |
} | |
// helpers | |
rehash = () => { |
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
class MaxHeap { | |
// creates an array of given length | |
constructor(length) { | |
this.data = new Array(length) | |
this.size = 0 | |
} | |
// helpers | |
rehash = () => { |
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
class Node { | |
// stores given value and points to nothing | |
constructor (value) { | |
this.value = value | |
this.left = null | |
this.right = null | |
} | |
} | |
class Tree { |
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
class Node { | |
// stores given value and points to nothing | |
constructor (value) { | |
this.value = value | |
this.left = null | |
this.right = null | |
} | |
} | |
class Tree { |
OlderNewer