
Algorithms explained - YourBasic
Introduction to algorithms, data structures and algorithm analysis, all with plenty of code examples.
Algorithms to Go · YourBasic
Go libraries Your basic graph: graph algorithms and data structures MSD radix sort: a fast string sorting algorithm Bitset: set data structure for positive numbers Bloom filter: probabilistic set data structure …
Introduction to graph algorithms: definitions and examples
This text introduces basic graph terminology, standard graph data structures, and three fundamental algorithms for traversing a graph in a systematic way. You may also want to take a look at the Github …
Dynamic programming [step-by-step example] · YourBasic
CODE EXAMPLE A dynamic programming algorithm solves a complex problem by dividing it into subproblems, solving each of those just once, and storing their solutions.
Hash tables explained [step-by-step example] · YourBasic
Hash tables explained [step-by-step example] yourbasic.org Basics Hashing with chaining (simplified example) Realistic hash function example Resizing in constant amortized time Basics Hash tables …
Insertion sort vs. selection sort (time complexity and performance)
Insertion sort is a simple sorting algorithm with quadratic worst-case time complexity, but in some cases it’s still the algorithm of choice. It’s efficient for small data sets.
Big O notation: definition and examples - YourBasic
For example, if an algorithm increments each number in a list of length n, we might say: “This algorithm runs in O (n) time and performs O (1) work for each element”. Here is the formal mathematical …
How to analyze time complexity: Count your steps - YourBasic
This can be achieved by choosing an elementary operation, which the algorithm performs repeatedly, and define the time complexity T (n) as the number of such operations the algorithm performs given …
Loop invariants can give you coding superpowers - YourBasic
When struggling with a tricky 3-way partition algorithm as a student, a friend suggested a well-fitting invariant. It was like getting a secret superpower: suddenly I could write code that used to be …
Bloom filters explained · YourBasic
A Bloom filter is a probabilistic data structure used to test set membership. It tells if an element may be in a set, or definitely isn’t.