Thirty seconds over Ternary Search tree

Wow! It’s been another week from the time when I wrote the previous article about grokking algorithms. The time is passing so fast I barely can see it! Today I want to introduce a new concept to you - Ternary Search Tree (aka TST). You may already have heard about Binary Search Tree (aka BST) and this idea is pretty similar. Don’t worry if you did not hear about BST or any trees at all before, TST is pretty easy to understand and you will quickly nail it!...

February 2, 2022 · 6 min · 1091 words · Me

A fish called Fenwick tree

You may wonder, “Fenwick what? Which tree???”. Don’t be afraid of the spooky term the idea is pretty innocent. Remember: fear is the path to the dark side. First of all, let’s start with a simple problem: Imagine you have an array a of integers of length n. For the sake of simplicity let’s assume it is a one-dimensional array. You are given 2 values start and finish and your goal is to find a sum of all elements in this array between start and finish....

January 19, 2022 · 13 min · 2686 words · Me