Trie data structure

I recently learned about a trie data structure. While it may not be as widespread as arrays, hash tables, linked lists, or binary trees, there are applications where it excels. The main advantage of a trie is that you can search in constant time, regardless of how many elements it contains. This makes tries useful for autocomplete systems, spell checkers, dictionaries, and similar applications.

A tree in black and white

Read more...

Secret Handshake: Solving an exercise using bitwise operators and comparing performance

A couple of days ago, I took on an interesting task on Exercism. You can find the full description here. The goal is to create a function that takes a number between 1 and 31 and converts it to a list of actions. The sequence is defined by the five rightmost digits of the number when converted to binary. If you're unfamiliar with the binary system, I recommend reading this explanation first.

In this post, I'll discuss how I gradually improved my initial solution and share some interesting findings about the performance of different approaches.

Read more...