Skip to content

Instantly share code, notes, and snippets.

View javi830810's full-sized avatar

Javier de Paula javi830810

  • Ultimate Software
  • Miami, FL
View GitHub Profile
@javi830810
javi830810 / cities.py
Last active September 25, 2015 14:22
from sys import stdin
#amount = int(stdin.readline())
class Node(object):
def __init__(self, id):
self.id = id
self.neighboors = []
class Edge(object):
@javi830810
javi830810 / triplebyte.py
Created September 23, 2015 19:14
Operator insertion
def f(digits, target, current=None, rest=None):
"""
It doesnt work for the given case, it does for small runs
Some performance situation...
The idea is to try each digit with each of the operators
once the digit have been used, it will be appended to the current
and a new iteration will be done with the other digits.
@javi830810
javi830810 / polish_notation.py
Last active October 15, 2015 14:38
Polish notation
class Stack(object):
def __init__(self):
self.stack = []
def push(self, elem):
self.stack.append(elem)
def pow(a,b):
if b == 0:
return 1
if b == 1:
return a
if b % 2 == 1:
return pow(a,b/2)*pow(a,b/2)*a
if b % 2 == 0:
return pow(a,b/2)*pow(a,b/2)
def is_int(c):
return ord(c) >= 48 and ord(c) <= 58
def get_int(c):
return ord(c) - 48
def int_to_parse(input):
result = 0
for x in xrange(0, len(input)):
character = input[x]
class BTree(object):
def __init__(self, value, left=None, right=None):
self.value = value
self.left = left
self.right = right
def bfs(self):
arr = [1,2,3, 4, 5, 6]
#In Place
def binary_search(elem, arr, init=None, end=None):
if not init and not end:
init = 0
end = len(arr)
if end < init or init >= len(arr):
@javi830810
javi830810 / my_dict.go
Last active May 10, 2016 15:54
My Dictionary
package main
import (
"errors"
"fmt"
)
type KeyPair struct{
key string
value string
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"flag"
"time"
)
class Tree(object):
def __init__(self, value):
self.value = value
self.left = None
self.right = None
def add(self, number):