Category Archives: Technology
Computing similarities between datasets
Similarity measures is used all over the web and is pretty well known by anyone who has performed Internet searches using a search engine. Assuming the entire internet comprising of all the websites as one single database which could be divided into two classes – those which can answer your query and other which cannot. […]
Wrote my first strategy game – KALAH!
Kalah or Mancala is a strategy game. It is a two-player game and heavily favors the person who starts playing first. Each participant starts with certain number of seeds which are randomly allocated. At every turn, the user tries to grab seeds from the opponent’s house. The goal is to finish the game with the […]
Optimization using Hill Climbing
The following example shows how to find the best portfolio configuration given that only the price of a single stock can be incremented by 10 cents at a time. Since we are using Hill Climbing technique, we can find the local optimal value easily but the same cannot be said for finding the global optimal […]
Prefix Tree
Creating a prefix tree is quite easy in Python! root = {} def addToTree(node, word=()): if not word: return addToTree(node.setdefault(word[0], {}), word[1: ]) def main(): for word in (‘batman’, ‘bane’, ‘bale’,): addToTree(root, word) print root Output: {‘b’: { ‘a’: { ‘l’: { ‘e’: {} }, ‘n’: { ‘e’: {} }, ‘t’: { ‘m’: { ‘a’: […]
Login