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 Graph = function() { | |
var nodes = { | |
'a': { id: 'a', state: 'unvisited', output: ['b','c','d']}, | |
'b': { id: 'b', state: 'unvisited', output: ['e']}, | |
'c': { id: 'c', state: 'unvisited', output: ['e']}, | |
'd': { id: 'd', state: 'unvisited', output: ['f']}, | |
'e': { id: 'e', state: 'unvisited', output: ['f']}, | |
'f': { id: 'f', state: 'unvisited', output: ['g']}, | |
'g': { id: 'g', state: 'unvisited', output: []} |
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
/* Verify if a given string has a proper parenthesis setup */ | |
function verify(str) { | |
var array = str.split(''); | |
var stack = []; | |
var left = ['{','[','(']; | |
var right = ['}',']',')']; | |
var opposite = { | |
')':'(', | |
'}':'{', |