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
| // Available variables: | |
| // - Machine | |
| // - interpret | |
| // - assign | |
| // - send | |
| // - sendParent | |
| // - spawn | |
| // - raise | |
| // - actions |
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
| import React, {Component} from 'react' | |
| import styled from 'styled-components' | |
| const Title = styled.h1` | |
| color: red; | |
| text-decoration: underline; | |
| text-decoration-color: black; | |
| ` | |
| // Extend styling // | |
| const BiggerTitle = Title.extend` |
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
| Tree.prototype.findBFS = function (node) { | |
| let queue = [this.root] | |
| while (queue.length > 0) { | |
| let currentNode = queue.shift() | |
| if (currentNode.value == node) { | |
| return currentNode | |
| } |
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
| Tree.prototype.findDFS = function (node) { | |
| let stack = [this.root] | |
| while (stack.length > 0) { | |
| let currentNode = stack.pop() | |
| if (currentNode.value == node) { | |
| return currentNode | |
| } |
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 (value) { | |
| this.value = value | |
| this.parent = null | |
| this.children = [] | |
| } | |
| function Tree() { | |
| this.root = null | |
| } |