[quote]My Lab assignment just corrupted and I hadn't finished debugging my errors. I last worked on it two days ago. I can't remember what I had after a week of debugging and tweaking. my assignment was due last night, but my professor gave me a extension for a few hours (that is almost up and I am nowhere! Its like my brain is fried for finals!) Any and all help .. please! here is the info....
if (Same(iVector1))
cout << "iVector1 values are in the same order forwards and backwards\n";
else
cout << "iVector1 values are NOT in the same order forwards and backwards\n";
if (Same(iVector2))
cout << "iVector2 values are in the same order forwards and backwards\n";
else
cout << "iVector2 values are NOT in the same order forwards and backwards\n";
if (Same(sVector1))
cout << "sVector1 values are in the same order forwards and backwards\n";
else
cout << "sVector1 values are NOT in the same order forwards and backwards\n";
if (Same(sVector2))
cout << "sVector2 values are in the same order forwards and backwards\n";
else
cout << "sVector2 values are NOT in the same order forwards and backwards\n";
/*Write the code for this function. You must use one STL stack of
type T and one STL queue of type T. You should not have more than 15 lines of
code total.*/
}[/code]
and documentation
[quote]Finish the code for Lab10a.cpp . You will write code for the Same function which will return
true if the values of the elements of the vector that is passed to it are the same read both
forwards and backwards. If they are not the same in both directions, it will return false.
Don’t change anything in the main function or add any additional functions to the program.
Output should match iVector1 same order, iVector2 Not same order, sVector1 same, and sVector2 not in same order.
and then the second part:
Trees - Part B (25 points)
Please complete the program below exactly as described. Don’t add anything extra to it
(methods, extra variables, features, etc.) and don’t leave any features described below out.
You are going to write a function that will use recursion to count the number of nodes in a tree. First
use the code on page 1141-1142 to develop the IntBinaryTree class (For the member functions,
you only need the code for the constructor and the insert member function). Your main program will
call a public member function called numNodes. This function will then call a private member
function, countNodes, that will use recursion to count the number of nodes in the entire tree: [code]int IntBinaryTree::countNodes(TreeNode *nodePtr)
{
if (nodePtr == NULL)
//write only one line of code here
else
//write only one line of code here
}
cout <<"The number of nodes in the tree is: " << tree.numNodes()<<endl;
return 0;
}[/code]
Code from pages 1140-1142:
InBinaryTree.h
[code]// Specification file for the IntBinaryTree class
#ifndef INTBINARYTREE_H
#define INTBINARYTREE_H
class IntBinaryTree
{
private:
struct TreeNode
{
int value; // The value in the node
TreeNode *left; // Pointer to left child node
TreeNode *right; // Pointer to right child node
};
Dear customer, Unfortunately, your question requires a lot of work and cannot be done for free. Please submit it with all requirements as an assignment to our control panel and we'll assist you.
Comments
Leave a comment