PowerShell Algorithms and Data Structures
Algorithms and data structures implemented in PowerShell with explanations and links to further readings
This is a port of https://github.com/trekhleb/javascript-algorithms
This repository contains PowerShell 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).
How to use this repository
Run all tests
Invoke-Pester
Run tests by name
Invoke-Pester -TestName LinkedList
Data Structures
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.
- Linked List
- Queue
- Stack
- Hash Table
- Graph (both directed and undirected)
- Disjoint Set
Algorithms
An 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.
Algorithms by Topic
-
Math
- Factorial
- Fibonacci Number
- Primality Test (trial division method)
- Euclidean Algorithm - calculate the Greatest Common Divisor (GCD)
- Least Common Multiple (LCM)
Integer PartitionSieve of Eratosthenes - finding all prime numbers up to any given limitIs Power of Two - check if the number is power of two (naive and bitwise algorithms)
-
Sets
- Cartesian Product - product of multiple sets
- Power Set - all subsets of a set
- Longest Common Subsequence (LCS)
- Longest Increasing subsequence
- Maximum Subarray - "Brute Force" and "Dynamic Programming" (Kadane's) versions
-
Strings
- Levenshtein Distance - minimum edit distance between two sequences
- Hamming Distance - number of positions at which the symbols are different
- Longest Common Substring
-
Searches
-
Graphs
- Bellman-Ford Algorithm - finding shortest path to all graph vertices