Skip to content

Instantly share code, notes, and snippets.

@vcwu
vcwu / gist:2994478
Created June 26, 2012 08:49
poly.cpp
/*
CS 352, Summer '12
Victoria Wu
Polynomial ADT
poly.cpp
-----------------------------------------
The polynomial is represented by a linked list of pairs, each containing
the coefficient and exponents of each term.
s
@vcwu
vcwu / gist:2994486
Created June 26, 2012 08:50
poly.h
/*
CS 352, Summer '12
Victoria Wu
Polynomial ADT
-----------------------------------------
The polynomial is represented by a linked list of terms, each containing
the coefficient and exponents of each term.
-Add, Multiply, Equality functions for polynomials
@vcwu
vcwu / gist:2994501
Created June 26, 2012 08:52
polyTester.cpp
/*
CS 352, Summer '12
Victoria Wu
Polynomial ADT Tester
-----------------------------------------
*/
#include <iostream>
@vcwu
vcwu / gist:2994575
Created June 26, 2012 09:06
simplifyTester_actual
fstream simp;
simp.open("simplify_test.txt");
Poly* pol1 = new Poly();
for(int i =0; i< 3; i++)
{
term t1(5, 1, 1);
pol1->addTerm(t1);
}
@vcwu
vcwu / gist:2994599
Created June 26, 2012 09:14
simplify tester actual _2
Poly* pol1 = new Poly();
for(int i =0; i< 3; i++)
{
term t1(5, 1, i);
pol1->addTerm(t1);
term t2(5, 1, i);
pol1->addTerm(t1);
pol1->addTerm(t2);
}
@vcwu
vcwu / gist:3080860
Created July 10, 2012 03:53
testing with one logical node
//Making a Testing Tree, with many physical, one logical obj.
//------------------------------------------------
Treap<Student>* oneLogical = new Treap<Student>();
oneLogical->insert(smallest);
for(int x = 0; x< 2; x++)
{
oneLogical->insert(allStudents[x]);
oneLogical->remove(allStudents[x]);
}
for(int i =10000; i<= 160000; i*=2)
{
Treap<int>* time = new Treap<int>();
begin = clock();
for(int x = 0; x < i; x++)
{
time->insert(x);
}
end = clock();
for(int i =10000; i<= 160000; i*=2)
{
Treap<Student>* time = new Treap<Student>();
Student hello;
for(int x = 0; x < i; x++)
{
hello = Student(x);
time->insert(hello);
cout << "Finding Min Stuff " << endl << endl;
for(int i =100000; i<= 1600000; i*=2)
{
Treap<Student>* time = new Treap<Student>();
Student hello;
for(int x = 0; x < i; x++)
{
for(int i =10000; i<= 160000; i*=2)
{
Treap<Student>* time = new Treap<Student>();
Student hello;
for(int x = 0; x < i; x++)
{
hello = Student(x);
time->insert(hello);