Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Count Repetitions #18

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Count Repetitions #18

wants to merge 6 commits into from

Conversation

Dotfan
Copy link

@Dotfan Dotfan commented Feb 16, 2016

We should count only LAST repetitions. If we have repetitions of some first elements and then goes different, the "pivot - repetitions // 2" returns wrong value. For example:
we have:
11 11 11 11 8 7 4 21 26 11
after line 18 we have:
11 11 11 11 8 7 4 [11] 21 26
if we counted repetitions by your algorythm the function returns q=5 A[5] = 8, 8 > 7. We broke the main rule.

skanev and others added 6 commits November 1, 2015 18:06
clrs; problem 4-1g - add more detail to clarify already present answer
typos (sorry, just being a stickler :p)
We should count only LAST repetitions. If we have repetitions of some first elements and then goes different, the "pivot - repetitions // 2" returns wrong value. For example:
we have:
11 11 11 11 8 7 4 21 26 11
after line 18 we have:
11 11 11 11 8 7 4 [11] 21 26
if we counted repetitions by your algorythm the function returns q=5 A[5] = 8, 8 > 7. We broke the main rule.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants