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 { | |
| /** | |
| * @param {integer|string} id | |
| */ | |
| constructor(id) { | |
| this.id = id; | |
| this.children = []; | |
| } | |
| } |
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 Graph() { | |
| var vm = this; | |
| vm.vertices = []; | |
| vm.edges = []; | |
| vm.numberOfEdges = 0; | |
| vm.addVertex = function(vertex) { | |
| vm.vertices.push(vertex); | |
| vm.edges[vertex] = []; | |
| }; |
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 doDFS(root, tree) { | |
| var parentInfo = {}; | |
| parentInfo[root] = 'None'; | |
| recursionDFSvisit = function(source, tree) { | |
| tree[source].map(function(vertex) { | |
| if (!parentInfo[vertex]) { | |
| parentInfo[vertex] = source; | |
| recursionDFSvisit(vertex, 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
| /* | |
| * Performs a breadth-first search on a graph represent an object of array edges | |
| * @param {string} source - The source vertex. | |
| * @param {object} tree - Graph, represented as object. | |
| * @returns {object} Object of objects describing each vertex, like | |
| * { vertex : {distance: _, parent: _ } } | |
| */ | |
| function doBFS(sourse, tree) { | |
| var pathInfo = {}; | |
| var level = 1; |
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 HashTable() { | |
| var vm = this; | |
| vm._bucketSize = 10; | |
| vm._buckets = []; | |
| vm._buckets.length = vm._bucketSize; | |
| vm.hashCode = function(str) { | |
| var hash = 0, i, chr; | |
| if (str.length === 0) return hash; | |
| for (i = 0; i < str.length; i++) { |
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 Node(data) { | |
| this.data = data; | |
| this.next = null; | |
| } | |
| function SinglyList() { | |
| var vm = this; | |
| vm._length = 0; | |
| vm.head = null; |
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 swap(arr, keyA, keyB) { | |
| var temp = arr[keyA]; | |
| arr[keyA] = arr[keyB]; | |
| arr[keyB] = temp; | |
| }; | |
| function heapSort(arr) { | |
| var arrLen = arr.length; | |
| var heapRoot = function (arr, i) { | |
| var max = i; |
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 DocumentDistance() { | |
| var vm = this; | |
| vm.vec1 = null; | |
| vm.vec2 = null; | |
| vm.text1 = null; | |
| vm.text2 = null; | |
| vm.setVector = function(text) { | |
| var obj = {}; | |
| text.split(' ').map(function(w) { |
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
| === PHASE 1 - Basics === | |
| * [X] Grokking Algorithms book | |
| * [ ] Grokking Videos Algorithms in Motion Beau Carnes https://www.manning.com/dashboard | |
| * [ ] Intro To Algorithms MIT Videos - 6.006 - https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/ | |
| * [ ] Algorithm Design Manual Videos | |
| * [ ] Read the Algorithm Design Manual | |
| * [ ] Watch the Princeton Coursera course on algorithms (by Robert Sedgewick), mostly up until Dijkstra’s algorithm and not much more than that. Try to follow along and code as you go. You don’t need to implement things in Java unless you already know Java.(Phase 3) | |
| * [ ] InterviewCake | |
| === PHASE 2 - Practice === |
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
| set nocompatible " be iMproved, required | |
| filetype off " required | |
| " set the runtime path to include Vundle and initialize | |
| set rtp+=~/.vim/bundle/Vundle.vim | |
| call vundle#begin() | |
| " alternatively, pass a path where Vundle should install plugins | |
| "call vundle#begin('~/some/path/here') | |
| "part of ~/.vimrc |
NewerOlder