• Here are all articles tagged Python
  • Introduction to Graph Theory: Finding The Shortest Path

    Posted on February 9th, 2013 | Tags: Data Structures, Python, Ruby

    Graph theory is one of those things in the computer science field that has the stigma of being extremely hard and near impossible to understand. My goal for this post is to introduce you to graph theory and show you one approach to finding the shortest path in a graph using Dijkstra's Algorithm. Don't worry about learning everything in one go. If you can walk away with a few concepts and one or two things implanted in your memory you're well on …

    read more

  • Creating a Simple Bloom Filter

    Posted on February 2nd, 2013 | Tags: Python, Data Structures

    Bloom filters are super efficient data structures that allow us to tell if an object is most likely in a data set or not by checking a few bits. Bloom filters return some false positives but no false negatives. Luckily we can control the amount of false positives we receive with a trade off of time and memory.

    You may have never heard of a bloom filter before but you've probably interacted with one at some point. For instance if you use …

    read more

  • Python Shortcuts for the Python Beginner

    Posted on January 26th, 2013 | Tags: Python

    The following are just a collection of some useful shortcuts and tools I've found in Python over the years. Hopefully you find them helpful.

    Swapping Variables

    x = 6
    y = 5
    
    x, y = y, x
    
    print x
    >>> 5
    print y
    >>> 6
    

    Inline if Statement

    print "Hello" if True else "World"
    >>> Hello
    

    Concatenations

    The last one is a pretty cool way to combine objects of two different types.

    nfc = ["Packers", "49ers"]
    afc = ["Ravens", "Patriots"]
    print nfc + afc
    >>> ['Packers', '49ers', …

    read more

Newer Posts >>