This project was created to practice the development of algorithms using Javascript(ES6). Each directory represents a different algorithm. One algorithm can contains more than one solution, that can have different complexities.
-
[algorithm-name]
[algorithm-description]
- [algorithm-name]__[solution-name].js
- [algorithm-name].test.js
-
Anagrams
Returns true if two passed strings are anagrams.
- Using map
- Using sort
-
Array chunk
Returns a piece of an array with the passed length.
- Using for
- Using slice
-
Breadth first search
Traverse a graph exploring the neighbor nodes first.
- Using queue
-
Binary Search Tree
Implementation of a binary search tree.
-
Capitalize
Capitalize a string.
- Using for
- Using slice
-
Circular
Returns true if a linked list is circular
-
Depth first search
Traverse a graph exploring as far as possible before backtracking.
- Using stack
- Using recursion
-
Dynamic Array
Even though Javascript's arrays are dynamic, it simulates the implementation of dynamic arrays.
-
Fibonacci
Returns the nth number of the Fibonacci sequence.
- Using for
- Using recursion
- Using memoization
-
FizzBuzz
Prints all numbers between 1 and n. For multiples of 3, print 'fizz' instead of the number. For multiples of 5, print 'buzz' instead of the number. And for multiples of 3 and 5, print 'fizzbuzz' instead of the number. of the number.
- Using for
- Using Array's forEach method
-
FromLast
Returns the distance of a node from a linked list to the last node.
-
Level Width
Returns the widths of each level of a given tree.
-
Linked List
Implementation of a linked list.
-
Max chars
Returns the most common char of a string.
- Using map
-
Midpoint
Returns the middle node of a linked list.
-
Palindrome
Returns true if the word is a palindrome.
- Using for
- Using recursion
- Using reverse
-
Pyramid
Prints an pyramid.
- Using for
- Using recursion
-
Queue
Class that implements a queue.
-
Queue from Stack
Class that implements a queue based on two stacks.
-
Reverse int
Returns the integer reversed.
- Using reverse
-
Reverse string
Returns the string reversed.
- Using for
- Using recursion
- Using reverse
-
Spiral Matrix
Returns a spiral matrix.
- Using for
-
Stack
Class that implements a stack.
-
Steps
Prints an stair.
- Using for
- Using recursion
-
Tree
Implementation of a tree data structure.
-
Validate BST
Returns true if a given tree is a binary search tree.
-
Vowels
Returns the number of vowels of the word.
- Using for
- Using regexp
-
Weave
Combines two queues into one, even if the lengths are different.