๐ Algorithms and data structures implemented in TypeScript.
A data structure is a data organization, management, and storage format that enables efficient access and modification. More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.
- Queue - a data structure to follow the FIFO principle;
- Graph - a set of vertices and edges;
- Stack - a data structure to follow the LIFO principle;
- Linked list - a data structure to follow the FIFO principle;
- Vector - is used to represent the mathematical vector used in linear algebra;
- Hash table - is used for lookup, where keys are hashed;
An algorithm is a finite sequence of well-defined, computer-implementable instructions, typically to solve a class of problems or to perform a computation.
- Search
- Peak Finder (1d version) - find a peak in a one-dimensional array;
- Peak Finder (2d version) - find a peak a two-dimensional array;
- Binary search - find a position of the element in a sorted one-dimensional array;
- String
- Document distance - measure similarity between two strings;
- Is unique - check a string for uniqueness;
- Check permutation - check if a string is a permutation of the other;
- URLify - replace all spaces in a string with '%20';
- String compression - perform basic string compression using the counts of repeated characters;
- Rotate matrix - rotate the matrix by 90 degrees;
- Sort
- Insertion sort - sort an array with a simple insertion algorithm;
- Merge sort - sort an array with a merge sort algorithm;
- Heapsort - sort an array with a heapsort algorithm;
- Counting sort - sort an array with a counting sort algorithm;
- Radix sort - sort an array with a radix sort algorithm;
- Graph
- Breadth-first search - traverse a graph, explore neighbor vertices first;
- Depth-first search - traverse a graph, explore descendant vertices first;
- Dijkstra - find the shortest path between two vertices in a graph, return a shortest-path tree;
- Bellman-Ford - find the shortest path in a graph with negative edges, return a shortest-path tree;
- Topological sort - an algorithm for topological sorting, which is based on depth-first search;
Install all dependencies
npm install
Run all tests
npm test