void testheap() { cout << "Test Heap Started" << endl; sorter.run(); thearray = sorter.getArray(); CPPUNIT_ASSERT(thearray[0] == 5); CPPUNIT_ASSERT(thearray[1] == 4); CPPUNIT_ASSERT(thearray[2] == 3); CPPUNIT_ASSERT(thearray[3] == 2); CPPUNIT_ASSERT(thearray[4] == 1); CPPUNIT_ASSERT(thearray[5] == 0); cout << "Test Heap Ended" << endl; }
void setUp() { //int * array = new int[6]; sorter.setSize(6); thearray[0] = 1; thearray[1] = 3; thearray[2] = 0; thearray[3] = 5; thearray[4] = 2; thearray[5] = 4; sorter.setArray(thearray); }
int main() { // Link_Reverse_Test::test(); // bt_2_dl_test::test(); // int a[4] = { 4, 2, 3, 8 }; // mergesort(a, 0, 3); // int x = 3; //cout << "expect:" << ceil(x/2.0) << endl; //int upper = findLowerMidX(a, 4, x); //for(int i = 0; i < 4; ++i){ // cout << a[i] << "\t"; //} //cout << endl << "upper of x/2:" << upper << endl; // cout << "find idx of " << x << ":" << binaysearch(a, 0, 3, x); // int a[] = {-7, 5, 4, 2, -11, 10}; // int max[] = {-1, -1, -1}; // maxsub(a, 0, 5, max); // cout << max[0] << "\t" << max[1] << "\t" << max[2] << endl; int a[] = {5,3,17,10,84,19,6,22,9}; // buildheap(a, 9); // print(a, 9); //// heap::increaseKey(a, 8, 100); // int *p = heap::insert(a, 9, 100); // print(p, 10); // delete p; quicksort(a, 0, 8); print(a, 9); return 0; }
virtual void display(std::ostream & out) const { out << m_sort->get_name(); }
virtual unsigned hcons_hash() const { return m_sort->get_id(); }
void display(std::ostream & out) const override { out << m_sort->get_name(); }
unsigned hcons_hash() const override { return m_sort->get_id(); }