Skip to content

Latest commit

 

History

History
22 lines (13 loc) · 321 Bytes

192.md

File metadata and controls

22 lines (13 loc) · 321 Bytes

Word Frequency

Description

link


Solution

See Code


Code

O(nlogn)

# Read from the file words.txt and output the word frequency list to stdout.
cat words.txt | tr -s ' ' '\n' | sort | uniq -c | sort -r | awk '{ print $2, $1 }'