Algorithm reviews
Implement a method to perform basic string compression using the counts of repeated characters. For example, the string aabcccccaaa would become a2blc5a3. If the "compressed" string would not become smaller than the orig- inal string, your method should return the original string.
node basic-string-compression.test.js
An array contains share prices, calculate the best profit (buying before selling) for a single buy and sell during the set of data.
node best-profit.test.js
In the classic problem of the Towers of Hanoi, you have 3 towers and N disks of different sizes which can slide on to any tower. The puzzle starts with disks sorted in ascending order of size from top to bottom (i.e., each disk sits on top of an even larger one). You have the following constraints:
- Only one disk can be moved at a time.
- A disk is slid off the top of one tower onto the next tower.
- A disk can only be placed on top of a larger disk.
Write a program to move the disksfrom the first tower to the last using stacks.
node hannoi.test.js
Implement a Queue which implements a queue using two stacks.
node two-stack-queue.test.js
Implement a binary search tree with methods to insert, remove and walk the tree in order.
node binary-search-tree.test.js
Create a Heap, implementing push and pop methods
node heap.test.js
How would you verify a prime number?
node is-prime.test.js
Implement a bubble sort
node bubble-sort.test.js
Write a function to calculate the Nth number in the fibonacci sequence
node fibonacci.test.js
Reverse a given string
node reverse-string.test.js
Find all prime factors of a number
node prime-factors.test.js
Find all prime factors of a number, recursively
node prime-factors-recursive.test.js
Suppose we had an array of n integers sorted in ascending order. How quickly could we check if a given integer is in the array?
node quick-find-in-list.test.js
An Emitter class which can create subscriptions to named events and remove them. An emit method exists which will call each of the subscribed functions.
node event-emitter.test.js