U
U
uvelichitel2014-12-11 15:25:09
Programming
uvelichitel, 2014-12-11 15:25:09

How to calculate the vocabulary of text?

There is:
"mom washed the frame mom washed the mom"
Need:
mom - 3
soaps - 2
frames - 1
Enough space, inplace is not required.
Which is cheaper - sort and then add, or grow a binary tree and filter through it in one pass?
I looked through Kormen and did not find a direct answer.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2014-12-11
@uvelichitel

In the case of a binary tree, you can process an endless stream of words. In the case of sorting, you must know the entire text of the stack. I would stop at a binary tree, well, or at something in between.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question