Frequency ->
Arg Rc : &Array : < Word : String, F : Integer > 
    Text : String

Words : Array : String = <> ..

Words <- Text # ' '                                                            /* O(n) mem      */

If Words then
 Table : List : String <- Integer : [Length] = <> ..
 ' Length = NLog2N Words._

 - F >Table< Words,
   Sort >Rc< Table SORT_DESC ( 'Order_by Key Value : Order_by = Value )
;

/

F Frequency ->
Arg Frequency : &List : String <- Integer 
    Words : List : String    

Detach Words Word Other_words

If Frequency->>!Word then Frequency->Word = 1                                  /* O(log(n)) r/w */
Else Frequency->Word ++ 

If Other_words then
 - F Other_words *
Else
 /

NLog2N Frequency ->
Arg Max : Integer

N = Max ..

Do i = 2 to Max
 If i * (Log2 i) < Max then N = i, Iterate
 Else Leave
;

N

/
