Full Code is here: https://nekobin.com/yehukomiya
(Don't mind the computeFile() function)
Hi, I've got a text file with repeating chars in binary string like "0101001001111000010010011110010000000" I already got the KMPSearch() function that I use to count how many times a given sequence occurs in my string. I also count in the ex1() function the char that occurs most in the string, but what I want to achieve is find the most frequent sequence and how many times it occurs, and return the n sequences that repeat the most.
e.g.
s = "01010010010001000111101100001010011001111000010010011110010000000"
n = 20
I want to return the following list:
[
(4, ['0001', '0011', '1100' ]),
(5, ['011', '1000', '110' ]),
(6, ['0000', '111']),
(7, ['0010','1001' ]),
(8, ['0100']),
(10,['010']),
(11,['000', '001', '11']),
(12,['100']),
(15,['01','10']),
(23,['00'])
]
Where the firs column is the m-times the sequences occurs, the following column are the actual sequences that repeat themselves m times, and the number of entry in the list is n. It returns all the occurrences because n is less than the number of the occurrences it found. but if n was for example equal to 4 I wanted the list:
[
(11,['000', '001', '11']),
(12,['100']),
(15,['01','10']),
(23,['00'])
]
At the end I would also like to sort the final tuple as shown. Thank you all for your time and patience.