Skip to content

Instantly share code, notes, and snippets.

View CSEmbree's full-sized avatar

Cameron Embree CSEmbree

View GitHub Profile
hello;there;senor
how
are
you;today
@CSEmbree
CSEmbree / NondeterministicDirectedGraph.java
Created December 20, 2013 19:45
Following all paths in an NFA to see if some word is accepted.
//GLOBALS
ArrayList<String> alphabet; //all the characters for this a language
ArrayList<Vertex> graph; //set of all vertices containing edge relationships and cost requirments for traversal
private final String START = "S"; //file format quantifier for a START (initial) vertex
private final String END = "F"; //file format quantifier for a END (termination) vertex
//business method - decides whether a given word can reach a TERMINAL state in a TM (graph).
public boolean CheckWordAgainstGraph(String word)
@CSEmbree
CSEmbree / hello.py
Created October 14, 2013 03:54
hello world code in Python
#!/usr/bin/python
# Run with:
# python hello.py cameron
# python hello.py
# import modules used here -- sys is a very standard one
import sys
@CSEmbree
CSEmbree / merge.c
Created October 13, 2013 17:17
Merge Sort in C
#include "merge.h"
//top down merge sort
void MergeSort(int A[], int arraySize)
{
int B[arraySize]; //temp workspace
Split(A, 0, arraySize, B);
}
@CSEmbree
CSEmbree / insert.c
Created October 13, 2013 17:15
Insertion Sort in C
#include "insert.h"
void InsertionSort(int *list, int listLength)
{
int i, j, temp;
for( i = 0 ; i < listLength ; ++i )
{
temp = list[i]; // store the next element to sort
@CSEmbree
CSEmbree / FileManipulation.c
Created September 29, 2013 02:00
Example file open, parsing, and manipulation, and saving
//Example opening and parsing a *.txt file
//
//COMPILING: "gcc -g FileManipulation.c -o fm"
//RUNNING: "/.fm abc.txt"
#include "FileManipulation.h"
int main(int argc, char **argv)
{
//choose some filename and openmode