Skip to content

Instantly share code, notes, and snippets.

View MagallanesFito's full-sized avatar

Adolfo Fragoso Magallanes MagallanesFito

View GitHub Profile
@MagallanesFito
MagallanesFito / hobbies_list.txt
Created December 9, 2018 22:57
A list of most common hobbies in spanish and english
3D Printing
Abejas
Acolchado
Acrobacias Con Bicicletas
Acting
Actividades De La Iglesia
Actividades Informáticas
Actuacion
Actuar En Teatro
Acuarios
@jgcoded
jgcoded / traveling_salesman.cpp
Last active January 22, 2024 09:43
Traveling Salesman solution in c++ - dynamic programming solution with O(n^2 * 2^n).
#include <vector>
#include <iostream>
using namespace std;
/**
\brief Given a complete, undirected, weighted graph in the form of an adjacency matrix,
returns the smallest tour that visits all nodes and starts and ends at the same
node. This dynamic programming solution runs in O(n^2 * 2^n).
@econchick
econchick / gist:4666413
Last active December 22, 2023 13:32
Python implementation of Dijkstra's Algorithm
class Graph:
def __init__(self):
self.nodes = set()
self.edges = defaultdict(list)
self.distances = {}
def add_node(self, value):
self.nodes.add(value)
def add_edge(self, from_node, to_node, distance):