Skip to content

Instantly share code, notes, and snippets.

View vyruz's full-sized avatar

Luke vyruz

View GitHub Profile
@vyruz
vyruz / gist:4686680
Last active December 12, 2015 00:49
void remove_recursively(bt_node* top, int data){
if(top->data == data){
if(top->right == NULL && top->left == NULL){
top->data = NULL;
}else{
if(top->data < data){
remove_recursively(top->left, data);
}else{
remove_recursively(top->right, data);
}
#include "binary_search_tree.h"
bt_node* init_node(int data) {
// implement me
bt_node* new_node;
new_node->data = data;
new_node->left = NULL;
new_node->right = NULL;
return new_node;
}
@vyruz
vyruz / gist:4729192
Last active December 12, 2015 06:28
void bubblesort(vector<int> &data) {
bool swap = true;
int temp;
int size = data.size();
while(swap == true){
for(int i=0; i < size; i++){
if(data[i] < data[i-1]){
temp = data[i];
data[i] = data[i+1];
/*
fsm.cpp - Finite State Machine
Read the header file 'fsm.hpp' for all documentation on individual
functions. I suggest you start by getting the unit test cases to
pass in order. E.g. start with the Defaults one, then do Add States,
and so on.
Your Name: Luke Woodruff
@vyruz
vyruz / game.cpp
Last active December 16, 2015 15:39
#include "game.hpp"
#include <iostream>
#include <cstdlib>
using namespace std;
void output(player player1, player player2);
int main(){