i've been having trouble just figuring out the merging part of the code.
here's the main. everything works except for the merge part that is at the end of the code.
main()
{
HeapSort heap1;
HeapSort heap2;
int one, two;
int x = 0;
int number1,number2;
cout<< " Enter 10 numbers : " << endl;
while( x < 10)
{
cin>>number1;
heap1.store(number1,x);
x++;
}
cout << endl;
heap1.sort();
heap1.printHeap();
x = 0;
cout<<" now enter 10 more numbers: " << endl;
while( x < 10 )
{
cin>>number2;
heap2.store(number2,x);
x++;
}
heap2.sort();
heap2.printHeap();
// here's the part where i'm having trouble.
// these are references for number1 and number2
one = 0;
two = 0;
while( one < SIZE && two < SIZE )
{
a = heap1.returnvalue(one);
b = heap2.returnvalue(two);
if( a <= b)
{
a++;
}
else
{
cout<< b << endl;
b ++;
}
}
while( a < heap1.value (one))
{
a++;
}
while( b <heap2.value(two))
{
b++;
}
system("pause");
return 0;
}