Everything Fibonacci

Sun Oct 07 2018

If you have ever taken a computer science class you probably know what the fibonacci sequence is and how to calculate it. For those who don’t know: Fibonacci is a sequence of numbers starting with 0,1 whose next number is the sum of the two previous numbers. After having multiple of my CS classes give lectures and homeworks on the Fibonacci sequence; I decided to write a blog post going over the 4 main ways of calculating the nth term of the Fibonacci sequence. In addition to providing the python code for calculating the nth perm of the sequence, a proof for their validity and an analysis of their time complexities both mathematically and empirically will be examined.

Slow Recursive Definition

By the definition of the Fibonacci sequence, it is the most natural to write it as a recursive definition.

def fib(n):
    if n == 0 or n == 1:
        return n
    return fib(n-1) + fib(n-2)

Time Complexity



C to C++ Tutorial

Thu Aug 02 2018

This post aims to cover all the major topics that C programmers need to know before they start writing C++ programs. I kept this post as short and concise as possible to enable people to use this as a quick reference to quickly jump into C++. This post assumes that you have prior knowledge of both C and object oriented-programming concepts. Each topic is quickly covered in a code snippet and some additional explanation is provided if necessary.

Input/Output

Input and output in C++ is easy, you use “cout” and “cin”. When printing with “cout”, you separate what your printing with “<<”; “endl” prints a new line.

using namespace std;                        //namespaces talked about below
#include <iostream>                         //Include statement for terminal IO.

int main()
{
    cout << "Hello World" << endl;          // HELLO WORLD!
    
    int a;
    cin >> a;                               //inputs an int into a -- notice how arrows face the direction of IO
    
    cout << "You entered: " << a << endl;   //prints what you entered
    
    return 0;                               // return sucess code
}



Gremlin in 10 Minutes

Sat Jul 28 2018

What is Gremlin?

Gremlin is a graph traversal language: think of Gremlin as the SQL for graph databases. Gremlin is not a graph database server, it is a language; but, there is a Gremlin Server and a Gremlin Console available for interacting with graph databases. It is possible to use Gremlin on large database platforms like Titan and HBase.

Graph Data Base Basics

A graph database is based on graph theory. A graph is composed of nodes, edges, and properties. A key object/component in a graph database is stored as a node. Nodes are connected via edges representing relationships. For example, you may represent people as nodes and have edges representing friendships. You can assign properties to both nodes and edges. A person (node) may have the properties of age and name, where a friendship (edge) may have a start date property.

Why Graph Databases?



Node Website Optimization

Sun Jul 22 2018

It is a well-known fact that a fast website is critical towards having high user retention. Google looks favorable upon websites which are well optimized and fast. If you are using a CMS like WordPress or Wix, a lot of optimization is done automatically. If you like to build stuff from scratch like me, there is a ton of work required to optimize a website. This post will cover the 8 things that I did to decrease the load time of this blog written in node by two seconds.

Final Results

Final Website Speed Test
Final Website Speed Test

This is the result for a single blog post.



Steam Friends Graph

Tue Jun 26 2018

Links

Project Description

This project utilizes the steam API and graph databases to create friend graphs for clients in a web browser. Currently there are two types of graphs available: - Friends of Friends Graph: This graph displays all the steam friends of a single person and all their friend’s friends. - Common Friends Graph: This graph will only display your friends; however, it will draw edges between your friends’ if they are friends with each other.

Motivation