Skip to content

Instantly share code, notes, and snippets.

Daniel Santos imdanielsp

Block or report user

Report or block imdanielsp

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
@imdanielsp
imdanielsp / queue.c
Created Apr 23, 2017
Implementation of the Queue.
View queue.c
#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 Apr 23, 2017
Header of the Opaque Queue
View queue.h
/**
* \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 Apr 14, 2017
Base 2 and Base 10 Converter Script Using Local Functions
View base_converter.py
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
You can’t perform that action at this time.