Skip to content

Instantly share code, notes, and snippets.

@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]);
}
@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: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:2994501
Created June 26, 2012 08:52
polyTester.cpp
/*
CS 352, Summer '12
Victoria Wu
Polynomial ADT Tester
-----------------------------------------
*/
#include <iostream>
@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: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:2994374
Created June 26, 2012 08:25
multiply tester
for(int x = 100; x < 800; x += x)
{
Poly* pol1 = new Poly();
Poly* pol2 = new Poly();
for(int i = 0; i < x; i++)
{
//This ensures that no terms are like, and nothing
//will simplify.
term t1(i+1, i+2, i+3);
term t2(i+2, i+1, i+1);
@vcwu
vcwu / gist:2994298
Created June 26, 2012 08:08
testing Equality
for(int x = 1000; x < 16000; x += x)
{
Poly* pol1 = new Poly();
Poly* pol2 = new Poly();
for(int i = 0; i < x; i++)
{
//This ensures that no terms are alike,
//but both polynomials are equal.
term t1(i+1, 2,2+i);
term t2(i+2, 2,2+i);
@vcwu
vcwu / gist:2994212
Created June 26, 2012 07:50
addition _updated till 16000
for(int x = 1000; x < 16000; x += x)
{
Poly* pol1 = new Poly();
Poly* pol2 = new Poly();
for(int i = 0; i < x; i++)
{
//This ensures that no terms are like, and nothing
//will simplify.
term t1(i+1, i+2, i+3);
term t2(i+2, i+1, i+1);
@vcwu
vcwu / gist:2994175
Created June 26, 2012 07:44
simpify - made upper bound bigger
for(int x = 1000; x <= 32000; x += x)
{
Poly* pol1 = new Poly();
Poly* pol2 = new Poly();
for(int i = 0; i < x; i++)
{
//This ensures that all terms are alike.
term t1(i+1, 2,2);
term t2(i+2, 2,2);
pol1->addTerm(t1);