Skip to content

Instantly share code, notes, and snippets.

João Ventura joaoventura

Block or report user

Report or block joaoventura

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View httpserver.py
"""
Implements a simple HTTP/1.0 Server
"""
import socket
def handle_request(request):
"""Handles the HTTP request."""
@joaoventura
joaoventura / sierpinski.py
Created Feb 15, 2016
Sierpinski Triangle (with the animations)
View sierpinski.py
"""
Creates the Sierpinski triangle using the Chaos Game technique.
Starts from a vertex of a triangle, chooses randomly the next vertex and
draw a pixel in the middle. Then, iteratively selects a new vertex and
draws in the middle point.
"""
import random
View prob_search.py
"""
Implements linear search and probabilistic search to analyse time complexity.
"""
import random
from matplotlib import pyplot as plt
@joaoventura
joaoventura / binary_search.py
Created Dec 16, 2015
Comparison of linear-search and binary-search algorithms
View binary_search.py
"""
Implements linear search and binary search to analyse time complexity.
"""
import random
from matplotlib import pyplot as plt
View guessnumber.py
# A solution to the problem stated in
# https://www.codeeval.com/browse/170/
import math
def middleNumber(a, b):
""" Finds the middle integer between a and b.
If it is not a round number it rounds up to the
next integer.
You can’t perform that action at this time.