Skip to content

Instantly share code, notes, and snippets.

View imdanielsp's full-sized avatar

Daniel Santos imdanielsp

View GitHub Profile

Keybase proof

I hereby claim:

  • I am imdanielsp on github.
  • I am imdanielsp (https://keybase.io/imdanielsp) on keybase.
  • I have a public key ASC12PWP4XHmybUNGo8ytv8GWoC3K1Bln528KKaYIY0xmwo

To claim this, I am signing this object:

@imdanielsp
imdanielsp / queue.c
Created April 23, 2017 21:50
Implementation of the Queue.
#include <stdlib.h>
#include "queue.h"
#include "../LinkedList/linked_list.h"
struct Queue {
pLinkedList buffer;
};
pQueue makeQueue() {
pQueue newQueue = malloc(sizeof(Queue));
@imdanielsp
imdanielsp / queue.h
Created April 23, 2017 21:31
Header of the Opaque Queue
/**
* \brief T is the template type used in the queue. For other types
* support, change 'int' to the type desired.
* */
typedef int T;
/**
* \brief A forward declaration of the queue. This gives the client
* access to the Queue object itself without knowing the expecificts of the
* implementation making the object opaque.
@imdanielsp
imdanielsp / base_converter.py
Created April 14, 2017 20:19
Base 2 and Base 10 Converter Script Using Local Functions
def converter(number, base):
def convert_to_base_10(val):
target_base = 10 # Target number base
output_sum = 0 # Initial value for output sum
expo = 0 # Initial exponent
digits = [int(x) for x in str(val)] # Convert the base 2 number to an array of integer
digits.reverse() # Reverse the array.
for d in digits: # For each bit...
if d != 0: # If it's not 0, we will get the value relative to the position