C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old April 9th, 2003, 07:26 PM
jsf4700 jsf4700 is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2003
Posts: 1 jsf4700 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
<< overloading of Binary Search Tree

I am attempted to overload the << operator for a binary search tree and have run into a snag. Does anyone have any ideas on how to accomplish this? Does anyone know of any examples or could someone provide one? In the end, I hope to be able to have the user choose the order to print the nodes (preorder/inorder/postorder).

Here are my class definitions for the search tree, in case they help.

class binarySearchNode
{
friend class binarySearchTree;

int value; // Value store by the node

binarySearchNode * leftChild;
binarySearchNode * rightChild;

BinarySearchNode(int val);
};


class binarySearchTree
{
binarySearchNode * root;
int order; // Order of traversal
public:
... // Omitted the member functions
friend ostream & operator << (ostream &, const binarySearchTree &);
};


I've tried to call a recursive member function from the operator << method, but have not been able to make it work myself. I hope someone can help me out. If anymore information is required, I would be happy to provide it. Thanks in advance for any help anyone may provide.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > << overloading of Binary Search Tree


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

IBM developerWorks




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway