Skip to content

Instantly share code, notes, and snippets.

from tkinter import *
import math
import random
class No(object):
def __init__(self, val, esquerdo=None, direito=None):
self.val = val
self.esquerdo = esquerdo
self.direito = direito
@joaofeitoza13
joaofeitoza13 / searchs.py
Created April 28, 2018 20:39
Linear and Binary search implemented in python, ploted using matplotlib.
from random import *
from timeit import timeit
import matplotlib.pyplot as plt
def randomArray(length):
array = []
tmp = 0
while tmp < length:
num = randint(1, length*10)
if num not in array:
@joaofeitoza13
joaofeitoza13 / operations.py
Created April 12, 2018 16:17
Comparison by number of operations of each elementary Algorithm, in Python, plotted using matplotlib.
import matplotlib.pyplot as plt
from random import randint
import sys
sys.setrecursionlimit(100000)
def random_array(lenght):
array = []
while(len(array) < lenght):
x = randint(1, 10*lenght)
@joaofeitoza13
joaofeitoza13 / operations.py
Created April 11, 2018 20:57
Comparison by number of operations of each elementary Algorithm, in Python, plotted using matplotlib.
import matplotlib.pyplot as plt
from random import randint
import sys
sys.setrecursionlimit(100000)
def random_array(lenght):
array = []
while(len(array) < lenght):
x = randint(1, 10*lenght)
@joaofeitoza13
joaofeitoza13 / bucket.py
Last active March 14, 2018 21:12
Bucket Sort implemented in python, plot using matplotlib.
from random import randint
from timeit import timeit
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as interpolate
import math
def reverseArray(lenght):
@joaofeitoza13
joaofeitoza13 / radixsort.py
Created March 9, 2018 19:56
Radix sort implementd in python, ploted using matplotlib, smoothed using snipy.interpolate.
from random import randint
from timeit import timeit
import matplotlib as mpl
mpl.use('Agg')
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as interpolate
def reverseArray(lenght):
a = []
@joaofeitoza13
joaofeitoza13 / countingSort.py
Created March 7, 2018 20:43
Counting Sort implemented in python, ploted using matplotlib.
import matplotlib as mpl
mpl.use('Agg')
from random import randint
from timeit import timeit
import matplotlib.pyplot as plt
def reverseArray(lenght):
a = []
for i in range(lenght):
a.append(lenght-i)
@joaofeitoza13
joaofeitoza13 / shellsort.py
Created March 2, 2018 19:52
Shellsort implemented in python, ploted using matplotlib
from random import randint
from timeit import timeit
import matplotlib.pyplot as plt
def reverseArray(lenght):
a = []
for i in range(lenght):
a.append(lenght-i)
return a
@joaofeitoza13
joaofeitoza13 / mergesort.py
Created February 28, 2018 20:14
Code of mergesort implemented in Python, ploted using matplotlib.
from random import randint
from timeit import timeit
import matplotlib.pyplot as plt
def reverseArray(lenght):
a = []
for i in range(lenght):
a.append(lenght-i)
return a
@joaofeitoza13
joaofeitoza13 / quicksort.py
Created February 25, 2018 02:58
quicksort graph implemented in python using matplotlib library.
from random import shuffle
from timeit import timeit
import matplotlib.pyplot as plt
import sys
sys.setrecursionlimit(1000000)
def reverseArray(lenght):
a = []
for i in range(lenght):