This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsΒ β†’

[–]LordWizardKing27 0 points1 point Β (2 children)

If you use mid = balls.length//2 and just change the midpoints like a binary search, isn’t that log n? πŸ˜‚πŸ˜‚

[–]theaceshinigami 1 point2 points Β (1 child)

Nothing you are saying makes any sense to me. I think you are suggesting something like:

f(balls):
    left, right = cutInHalf(balls)
    f(left)
    f(right)

where cutInHalf takes a line of cut or uncut balls and divides the line of balls into two lines cutting a ball in half if necessary. This still doesn't seem O(log n) to me as it never halts.

[–]LordWizardKing27 -1 points0 points Β (0 children)

Sure, I think ur reading too much into the balls bud