Skip to content

Latest commit

 

History

History
51 lines (40 loc) · 1.19 KB

README.md

File metadata and controls

51 lines (40 loc) · 1.19 KB

Hasing Strings

All SI session info on csc3102si.rohankadkol.com

Intro

SI session recording

This is a code example to hash strings using the Horner's rule. For more information, refer to slide 13 of Dr Shah's slide deck, "3102 14 2020 (Hashing)" under the Moodle section, "Hashing".

Also you can watch the recording where I explain the algorithm and each line of code in detail.

To run the code (Linux / MacOS)

./main < textFile.txt

Sample Text File

the fox Fox Fox jumps jumps jumps in in in a cart jumps ,,./, steal the

Sample Output

$ ./main < textFile.txt 
**
hashAddress = 27
Word: in, Frequency: 3
Word: Fox, Frequency: 2
**
hashAddress = 38
Word: cart, Frequency: 1
**
hashAddress = 59
Word: fox, Frequency: 1
**
hashAddress = 85
Word: jumps, Frequency: 4
**
hashAddress = 97
Word: a, Frequency: 1
**
hashAddress = 126
Word: steal, Frequency: 1
**
hashAddress = 132
Word: the, Frequency: 2