Instantly share code, notes, and snippets.

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));
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.
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