Consider the need to use a dictionary. You will have to insert , look-up , remove words to and from it. What data structure would you use ? Would you use a hash table ? Would that be efficient in terms of memory? Perhaps not. A Trie is a tree like data structure used for storing words in a way…
Tag Archive for algorithms

A Swift Introduction to Algorithms – Part 1
Welcome to your journey throughout the vast world of algorithms! Whether you are still wondering what an algorithm is or hoping to deepen your knowledge about them, in this article will help you dive swiftly into the subject, carve out some valuable thinking patterns through various exercises and hammer a few hard problems using the power of algorithms. What…

Random Names using Markov Chains
Introduction In this tutorial we’ll look at generating plausible random names from a list of pre-existing names. We’ll also build a fun little app that lets you generate your Elf / Ninja name. Just generating random characters won’t give us reasonable results. We’ll use a list of preexisting names in order to generate new ones. We’ll take advantage of the…

Binary Search and Applications
In this tutorial we’ll look at one of the fundamental algorithms of computer science, binary search. We’ll also look at a practical application of binary search: implementing fast autocompletion. Introduction Consider the problem of finding an item in an array. The obvious solution is to go through all the items in the array and check if any of them is…

Random Pi
tl;dr I’m going to show you a little trick that uses random numbers to approximate the value of Pi. Monte Carlo methods (or Monte Carlo experiments) are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results; typically one runs simulations many times over in order to obtain the distribution of an unknown probabilistic…