Click here to Skip to main content
15,915,636 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Quick answer would be great Pin
toxcct26-Mar-06 3:44
toxcct26-Mar-06 3:44 
AnswerRe: Quick answer would be great Pin
eli1502197926-Mar-06 3:45
eli1502197926-Mar-06 3:45 
GeneralRe: Quick answer would be great Pin
Waldermort26-Mar-06 3:54
Waldermort26-Mar-06 3:54 
QuestionExporting functions with strings Pin
mosquitooth26-Mar-06 1:49
mosquitooth26-Mar-06 1:49 
AnswerRe: Exporting functions with strings Pin
Giannakakis Kostas26-Mar-06 18:35
professionalGiannakakis Kostas26-Mar-06 18:35 
AnswerRe: Abstract dataype Pin
PJ Arends26-Mar-06 11:31
professionalPJ Arends26-Mar-06 11:31 
QuestionText Formatting Pin
Waldermort26-Mar-06 1:38
Waldermort26-Mar-06 1:38 
QuestionClass Creation Problem Pin
vin36925-Mar-06 23:52
vin36925-Mar-06 23:52 
I need to write a wordlist class that inserts text into a binary search tree for processing. I have written a binary search tree class (below) and can input text directly into it but I am having a problem creating a wordlist class to do it. The wordlist class would also keep track of the total number of words in the list and the number of occurrences of each word. What would that class look like? Any suggestions would be greatly appreciated. Thanks.

template <class item="">
class bst_node
{
public:
// TYPEDEF
typedef Item value_type;
// CONSTRUCTOR
bst_node(
const Item& init_data = Item( ),
bst_node* init_left = NULL,
bst_node* init_right = NULL
)
{
data_field = init_data;
left_field = init_left;
right_field = init_right;
}
// MODIFICATION MEMBER FUNCTIONS
Item& data( ) { return data_field; }
bst_node* &left( ) { return left_field; }
bst_node* &right( ) { return right_field; }
void set_data(const Item& new_data) { data_field = new_data; }
void set_left(bst_node* new_left) { left_field = new_left; }
void set_right(bst_node* new_right) { right_field = new_right; }
// CONST MEMBER FUNCTIONS
const Item& data( ) const { return data_field; }
const bst_node* left( ) const { return left_field; }
const bst_node* right( ) const { return right_field; }
private:
Item data_field;
bst_node *left_field;
bst_node *right_field;
};

// NON-MEMBER FUNCTIONS for the bst_node<item>:
template <class item="">
void insert(bst_node<item>* &node_ptr, Item new_data);

template <class item="">
void print(const bst_node<item>* node_ptr);

template <class item="">
int tree_size(const bst_node<item>* node_ptr);
AnswerRe: Class Creation Problem Pin
Stephen Hewitt26-Mar-06 12:14
Stephen Hewitt26-Mar-06 12:14 
Questionfont of barcode Pin
includeh1025-Mar-06 22:27
includeh1025-Mar-06 22:27 
QuestionBeginner's Guide to DirectX Pin
WhatNameHasn'tBeenTakenYet25-Mar-06 22:10
WhatNameHasn'tBeenTakenYet25-Mar-06 22:10 
AnswerRe: Beginner's Guide to DirectX Pin
CaesarCZ25-Mar-06 23:06
CaesarCZ25-Mar-06 23:06 
GeneralRe: Beginner's Guide to DirectX Pin
WhatNameHasn'tBeenTakenYet25-Mar-06 23:52
WhatNameHasn'tBeenTakenYet25-Mar-06 23:52 
QuestionDisplaying float in MessageBox Pin
Steve Kelly25-Mar-06 20:59
Steve Kelly25-Mar-06 20:59 
AnswerRe: Displaying float in MessageBox Pin
Hamid_RT25-Mar-06 21:16
Hamid_RT25-Mar-06 21:16 
GeneralRe: Displaying float in MessageBox Pin
ThatsAlok26-Mar-06 17:59
ThatsAlok26-Mar-06 17:59 
AnswerRe: Displaying float in MessageBox Pin
Hamid_RT25-Mar-06 21:27
Hamid_RT25-Mar-06 21:27 
GeneralRe: Displaying float in MessageBox Pin
Steve Kelly25-Mar-06 21:38
Steve Kelly25-Mar-06 21:38 
GeneralRe: Displaying float in MessageBox Pin
Hamid_RT25-Mar-06 21:54
Hamid_RT25-Mar-06 21:54 
GeneralRe: Displaying float in MessageBox Pin
toxcct26-Mar-06 3:38
toxcct26-Mar-06 3:38 
GeneralRe: Displaying float in MessageBox Pin
Nish Nishant26-Mar-06 7:49
sitebuilderNish Nishant26-Mar-06 7:49 
GeneralRe: Displaying float in MessageBox Pin
toxcct26-Mar-06 20:31
toxcct26-Mar-06 20:31 
GeneralRe: Displaying float in MessageBox Pin
ThatsAlok26-Mar-06 18:01
ThatsAlok26-Mar-06 18:01 
GeneralRe: Displaying float in MessageBox Pin
normanS26-Mar-06 18:25
normanS26-Mar-06 18:25 
AnswerRe: Displaying float in MessageBox Pin
eli1502197926-Mar-06 1:44
eli1502197926-Mar-06 1:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.