Jump to content

Assistance with simple c++ programming assignment

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
1 reply to this topic

#1
genevish

genevish

    Newbie

  • Members
  • Pip
  • 2 posts
The task is to add a member function to provided red-black tree and stree classes. This function will calculate the average depth of each tree. I'm displaying this in my main program with these lines:

	cout << "The average number of steps for the stree is " << mystree.aveCompareSteps() << endl;

	cout << "The average number of steps for the rbtree is " << myrbtree.aveCompareSteps() << endl;


The problem is that it won't compile unless I comment out the second line. I get this error:

d_rbtree.h: In member function `int rbtree<T>::aveCompareSteps() [with T = std::string]':

main.cpp:55:   instantiated from here

d_rbtree.h:1033: error: no matching function for call to `rbtree<std::string>::getLevel(std::basic_string<char, 

std::char_traits<char>, std::allocator<char> >&)'

d_rbtree.h:1043: note: candidates are: int rbtree<T>::getLevel(rbnode<T>) [with T = std::string]

The functions are identical as far as I can tell (except for the references to rbtree/stree and rbnode/snode).

Thanks in advance for any guidance...

#2
genevish

genevish

    Newbie

  • Members
  • Pip
  • 2 posts
The whole code base (and a PDF showing the assignment) is here.

Thanks,

-Scott