BST

R

Rupert harrison

How would I approach the implementation of a BST that gives a statistical
breakdown of a text file and issues warnings on style eg. words too long or
big.

This is a hat. This is a dog.

# of words used: 5 // word - sequnce of letters
ending with a . , etc
# of unique words: 4 // unique - words spelled the
same
avg sentence length:
avg word length:
 
V

Victor Bazarov

Rupert harrison said:
How would I approach the implementation of a BST that gives a statistical
breakdown of a text file and issues warnings on style eg. words too long or
big.

Start with the description of your input and output. Then describe
what connects them (algorithm, I suppose). To fulfil the connection
you need some data structures. You may need other data structures
for input and output. Then you have a need to control the flow, you
may need more data structures for that... I don't see a C++ language
problem as of yet.
This is a hat. This is a dog.

# of words used: 5 // word - sequnce of letters
ending with a . , etc
# of unique words: 4 // unique - words spelled the
same

That's strange. I counted 8 words of which 5 unique...
 
K

Karl Heinz Buchegger

Rupert said:
How would I approach the implementation of a BST that gives a statistical

I don't know how you would approach it.

I would start with:
forget about statistical information and the BST at the moment and start
with identifying words in the input stream. I would use some code which
will be deleted later to convince myself that the reading part works
the way I want it to be.

Once that works I would start the implementation of a BST (without statistical
information, just the BST). I would continue with feeding the words from
step 1 into the BST and use that to debug the BST code. Again: Some later
to deleted debug-code, such as an output function for the whole BST will come
in handy.

Once that BST is working I would add to the nodes whatever is needed to enable the
statistical evaluation.


Home-work assignment done.

But that's just me. Your way of working may differ.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top