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
Hello World! |
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
export default { | |
up() {}, | |
down(size) { | |
const sizes = { | |
xs: "575.98px", | |
sm: "767.98px", | |
md: "991.98px", | |
lg: "1199.98px", | |
xl: "1600px", | |
} |
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
//Doubly Linked List is almost similar to singlyLinkedList, except every node has another pointer to the previous node. | |
class Node { | |
constructor(val, prev = null, next = null) { | |
this.val = val; | |
this.prev = prev; | |
this.next = next; | |
} | |
} |
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
//Stack implementation================================================================================== | |
// Stack is a container of objects that are inserted and removed according to the last-in first-out (LIFO) principle. | |
class Node { | |
constructor(data, next = null) { | |
this.data = data; | |
this.next = next; | |
} | |
} | |
class Stack { |
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
class Node { | |
constructor(value, priority) { | |
this.value = value; | |
this.priority = priority; | |
} | |
} | |
class PriorityQueue { | |
constructor() { | |
this.values = []; |
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
//Hash tables are collection of key value pairs. | |
//This hash function uses Array to store data and uses separate chaining to avoid key collusion. | |
//Only works on alphabetic character string keys. | |
class Hash { | |
constructor(size = 5) { | |
this.table = new Array(size); | |
} | |
//hashes the given key/value. Using the given key, it finds an index on the Table and returns that index. | |
_hash(key) { |
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
//breadth_First_Search | |
//This method, visits tree's node horizontally and pushes them. It uses queue to keep track of its work. | |
//Example: 10 | |
// 6 15 | |
// 3 8 20 | |
//result node would be =[10, 6, 15, 3, 8, 20] | |
//The Breadth-first search algorithm that's shown in here, is for data structures like `Binary Search Tree`. |
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
//IMPORTANT | |
//aLL the tree traversal comments are written in here are based on BST or Binary Search Tree. | |
//IMPORTANT | |
//============================================================================================================ | |
//breadth_First_Search | |
//This method, visits tree's node horizontally and pushes them. It uses queue to keep track of its work. |
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
In graph theory, a tree is an undirected graph in which any two vertices are connected by exactly one path, | |
or equivalently a connected acyclic undirected graph. | |
Which means, in a graph, we can reach a certain node in many different ways, but in a tree there should be only ONE way to reach that node. |
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
//The algorithm starts at the root node and explores as far as possible along each branch before backtracking | |
//To simplify, In Depth First Search in Binary Search Tree, travels through one side until it reaches its end and then tries the other side. | |
//============================================================================================================ | |
//DFS_PreOrder | |
//This method, visits the one specific side(either left or right) at once, and after the whole side is finished, then visits the other side. | |
// as it goes through the tree, it pushes visited node continuously. | |
//Example: 10 | |
// 6 15 | |
// 3 8 20 |
OlderNewer