Skip to content

Count Repetitions#18

Open
Dotfan wants to merge 6 commits intoskanev:masterfrom
Dotfan:patch-1
Open

Count Repetitions#18
Dotfan wants to merge 6 commits intoskanev:masterfrom
Dotfan:patch-1

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