trekhleb /
javascript-algorithms
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
Loading repository data…
HexCore8 / repository
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
🇺🇦 UKRAINE IS BEING ATTACKED BY RUSSIAN ARMY. CIVILIANS ARE GETTING KILLED. RESIDENTIAL AREAS ARE GETTING BOMBED.
- Help Ukraine via:
- More info on war.ukraine.ua and MFA of Ukraine
This repository contains JavaScript based examples of many popular algorithms and data structures.
Each algorithm and data structure has its own separate README with related explanations and links for further reading (including ones to YouTube videos).
Read this in other languages: 简体中文, 繁體中文, 한국어, 日本語, Polski, Français, Español, Português, Русский, Türkçe, Italiano, Bahasa Indonesia, Українська, Arabic, Tiếng Việt, Deutsch, Uzbek, עברית
A data structure is a particular way of organizing and storing data in a computer so that it can be accessed and modified efficiently. 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.
Remember that each data has its own trade-offs. And you need to pay attention more to why you're choosing a certain data structure than to how to implement it.
B - Beginner, A - Advanced
B Linked ListB Doubly Linked ListB QueueB StackB Hash TableB Heap - max and min heap versionsB Priority QueueA TrieA Tree
A Binary Search TreeA AVL TreeA Red-Black TreeA Segment Tree - with min/max/sum range queries examplesA Fenwick Tree (Binary Indexed Tree)A Graph (both directed and undirected)A Disjoint Set - a union–find data structure or merge–find setA Bloom FilterA LRU Cache - Least Recently Used (LRU) cacheAn algorithm is an unambiguous specification of how to solve a class of problems. It is a set of rules that precisely define a sequence of operations.
B - Beginner, A - Advanced
B Bit Manipulation - set/get/update/clear bits, multiplication/division by two, make negative etc.B Binary Floating Point - binary representation of the floating-point numbers.B FactorialB Fibonacci Number - classic and closed-form versionsB Prime Factors - finding prime factors and counting them using Hardy-Ramanujan's theoremB Primality Test (trial division method)B Euclidean Algorithm - calculate the Greatest Common Divisor (GCD)B Least Common Multiple (LCM)B Sieve of Eratosthenes - finding all prime numbers up to any given limitB Is Power of Two - check if the number is power of two (naive and bitwise algorithms)B Pascal's TriangleB Complex Number - complex numbers and basic operations with themB Radian & Degree - radians to degree and backwards conversionB Fast PoweringB Horner's method - polynomial evaluationB Matrices - matrices and basic matrix operations (multiplication, transposition, etc.)Selected from shared topics, language and repository description—not editorial ratings.
trekhleb /
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
IAmNithi /
📝Algorithms and data structures implemented in JavaScript with explanations
EliasAfara /
📝 Welcome to my Algorithmic Odyssey! This repository is a collection of algorithms and data structures that I've written, explored, and refined as part of my journey into the fascinating world of computer science and problem-solving.
B Euclidean Distance - distance between two points/vectors/matricesA Square Root - Newton's methodA Liu Hui π Algorithm - approximate π calculations based on N-gonsA Discrete Fourier Transform - decompose a function of time (a signal) into the frequencies that make it upB Cartesian Product - product of multiple setsB Fisher–Yates Shuffle - random permutation of a finite sequenceA Power Set - all subsets of a set (bitwise, backtracking, and cascading solutions)A Permutations (with and without repetitions)A Combinations (with and without repetitions)A Longest Common Subsequence (LCS)A Longest Increasing SubsequenceA Shortest Common Supersequence (SCS)A Knapsack Problem - "0/1" and "Unbound" onesA Maximum Subarray - "Brute Force" and "Dynamic Programming" (Kadane's) versionsA Combination Sum - find all combinations that form specific sumB Hamming Distance - number of positions at which the symbols are differentB Palindrome - check if the string is the same in reverseA Levenshtein Distance - minimum edit distance between two sequencesA Knuth–Morris–Pratt Algorithm (KMP Algorithm) - substring search (pattern matching)A Z Algorithm - substring search (pattern matching)A Rabin Karp Algorithm - substring searchA Longest Common SubstringA Regular Expression MatchingB Linear SearchB Jump Search (or Block Search) - search in sorted arrayB Binary Search - search in sorted arrayB Interpolation Search - search in uniformly distributed sorted arrayB Bubble SortB Selection SortB Insertion SortB Heap SortB Merge SortB Quicksort - in-place and non-in-place implementationsB ShellsortB Counting SortB Radix SortB Bucket SortB Depth-First Search (DFS)B Breadth-First Search (BFS)B Depth-First Search (DFS)B Breadth-First Search (BFS)B Kruskal’s Algorithm - finding Minimum Spanning Tree (MST) for weighted undirected graphA Dijkstra Algorithm - finding the shortest paths to all graph vertices from single vertexA Bellman-Ford Algorithm - finding the shortest paths to all graph vertices from single vertexA Floyd-Warshall Algorithm - find the shortest paths between all pairs of verticesA Detect Cycle - for both directed and undirected graphs (DFS and Disjoint Set based versions)A Prim’s Algorithm - finding Minimum Spanning Tree (MST) for weighted undirected graphA Topological Sorting - DFS methodA Articulation Points - Tarjan's algorithm (DFS based)A Bridges - DFS based algorithmA Eulerian Path and Eulerian Circuit - Fleury's algorithm - Visit every edge exactly onceA Hamiltonian Cycle - Visit every vertex exactly onceA Strongly Connected Components - Kosaraju's algorithmA Travelling Salesman Problem - shortest possible route that visits each city and returns to the origin cityB Polynomial Hash - rolling hash function based on polynomialB Rail Fence Cipher - a transposition cipher algorithm for encoding messagesB Caesar Cipher - simple substitution cipherB Hill Cipher - substitution cipher based on linear algebraB NanoNeuron - 7 simple JS functions that illustrate how machines can actually learn (forward/backward propagation)B k-NN - k-nearest neighbors classification algorithmB k-Means - k-Means clustering algorithmB Seam Carving - content-aware image resizing algorithmB Weighted Random - select thevgenykolotov-it /
📝 Algorithms and data structures implemented in TypeScript with explanations and links to further readings.
kokoforbes /
📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
KiriLL4101 /
📝 Let's practices the algorithms and data-structures using only Typescript and TDD (The exercises are from FreeCodeCamp, Rosetta code and Euler project)