Skip to content

Instantly share code, notes, and snippets.

View willamesoares's full-sized avatar

Will Soares willamesoares

View GitHub Profile
# Configurar Seller, Marketplace, bucket e nome da planilha
seller_id = 923
marketplace = MarketPlace.b2w
bucket = "aleap-willsoares"
sheet_name = "millevine.xls"
# Buscar Seller e AchieveLeap Seller no Marketplace correspondente
s = Seller.find seller_id
as = AchieveLeap::Seller.new s, market_place: marketplace
@willamesoares
willamesoares / README.md
Last active January 17, 2018 15:55
Hufman's Algorithm

HUFFMAN'S CODE IMPLEMENTATION - PYTHON 2.7

HOW DOES IT WORK?

  • In this specific implementation, the correctness of the code generated can be prooved manually by following the workflow of the algorithm, described below:
  1. A dictionary in Python was used as the primary data structure. In order to deal with all the characters and calculate their frequencies, each character given in the message is added to this dictionary and the values for each key (character) represents its frequency. Due to that, the caracters within the dictionary are automatically sorted in alphabetical order.
  2. In every step, an auxiliar array is generated with sorted items from the dictionary, but this time they are sorted by the values for each key.
  3. With that, the first two items are summed in order to get the frequency for a new node, that represents those characters union.
  4. A
@willamesoares
willamesoares / BSTNode.py
Last active November 22, 2015 17:05 — forked from stummjr/BSTNode.py
BSTNode.py - Binary Search Tree
# -*- encoding:utf-8 -*-
#from __future__ import print_function
class BSTNode(object):
def __init__(self, key, value=None, left=None, right=None):
self.key = key
self.value = value
self.left = left
self.right = right
@willamesoares
willamesoares / Derivada
Created February 2, 2014 15:55
Calculating the derivative of a polynomial function.
/*
Name: Derivada
Copyright:
Author: Soares Barroso, Willame
Date: 27/10/13 21:17
Description: Calculation of the derivative of a polynomial function
*/
#include <stdlib.h>
#include <stdio.h>