During my Master's in Computer Science from Stony Brook University, I studied the course - Algorithmic Problem Solving.
In this repository, you will come across some amazing algorithms that are very useful and have wide applications.
You can see the list of algorithms covered below. You will find the code to the below algorithms in the below serial number. (file name may be different, but serial number matches with those in the file names)
- Brute Force PageRank Algorithm:
This algorithms converges after some iterations and finally we can rank the pages based on their page rank values. - Page Rank using Eigenvectors
- Brute Force PageRank with teleportation factor:
This algorithm converges in fewer iterations compared to the brute force algorithm. - Page Rank using Eigenvectors with teleportation factor
- Python code to plot the pagerank values of the pages (in a single plot) in the digraph as a function of the teleportation factor (varying the factor like this: 0.1, 0.2, 0.3, so on till 0.9)
- Page Rank using repeated squaring method without teleportation factor
- Find all matching occurrences of a pattern within the larger text string using Rabin Karp Algorithm.
Here, you will learn the beautiful and elegant "Rolling hash" technique to generate hashses efficiently.
The actual was as follows:
Consider the text string “mississippippissi”. We wish to find all matching occurrences of the pattern “ippi” within the larger text string. Assume that Σ = {a, b, c, … , z}. (i) [10 points] Apply Rabin-Karp. Show the value of the rolling hash in each step. Also show the value of the hash for the pattern “issip”. When calculating the hashes of the strings, characters should be converted to integers by calculating their offset from the character ‘a’. That is, the letter ‘c’ would have a value of ‘c’-’a’ = 2 and the character ‘z’ would have a value of 25. When calculating the polynomial hash, set the base of the polynomial to be 13, and the hash modulus to be 31.
The output was as below:
Pattern is “ippi” Pattern Hash is 9
miss : 6
issi : 28
ssis : 23
siss : 13
issi : 28
ssip : 20
sipp : 2
ippi : 9
Pattern found starting at index : 7
ppip : 21
pipp : 14
ippi : 9
Pattern found starting at index : 10
ppis : 24
piss : 25
issi : 28
Pattern is “issip” Pattern Hash is 7