This file contains 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 matchParenthesis(str){ | |
const stack = [] | |
const opening = /(\(|\{|\[)/ | |
const closing = /(\)|\}|\])/ | |
if(!str || !str.length) return undefined | |
for(let i = 0; i < str.length; i++){ |
This file contains 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 HashTable(){ | |
this.table = new Array(3) | |
this.itemsLength = 0 | |
this.hashStringToInt = (str, tableSize) => { | |
let hash = 13 | |
for (let i = 0; i < str.length; i++){ | |
hash = (13 * hash * str.charCodeAt(i)) | |
} |
This file contains 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 LinkedList(){ | |
this.length = 0; | |
this.head = null | |
const Node = function(element) { | |
this.element = element | |
this.next = null | |
} | |
this.add = (element) => { |