Skip to main content
11 events
when toggle format what by license comment
Apr 13, 2017 at 12:40 history edited CommunityBot
replaced http://codereview.stackexchange.com/ with https://codereview.stackexchange.com/
Nov 1, 2015 at 21:16 comment added oliverpool "it only saves you one iteration" only if you search the element. If you search the bounds, it might turn out to be worse. For instance, search for 1: {0, 1, 2, 2, 2, 2, 2, 2, 2}.
Nov 1, 2015 at 19:19 comment added Gareth Rees Why not just bisect_left(l, x), bisect_right(l, x) - 1? The worry about reusing the bounds seems misplaced to me. In the average case you're searching an array that's half the size—but it's a binary search, so it only saves you one iteration. Whereas the bisect module has a fast C implementation.
Oct 28, 2015 at 15:44 answer added SuperBiasedMan timeline score: 1
Oct 25, 2015 at 14:29 history edited ferada CC BY-SA 3.0
Mark code as Python, remove fluff.
Oct 25, 2015 at 13:20 answer added oliverpool timeline score: 1
Oct 24, 2015 at 19:48 history edited holroy
added reinventing-the-wheel tag
Oct 24, 2015 at 15:09 answer added tokland timeline score: 1
Oct 24, 2015 at 12:17 comment added oliverpool I implemented it on purpose (and I think using bisect the search for the second extremity of the sequence can't be optimized - whereas I'm reusing the bounds of my dichotomic search)
Oct 24, 2015 at 11:53 comment added jonrsharpe Do you know about bisect (i.e. did you implement that search yourself on purpose)?
Oct 24, 2015 at 11:11 history asked oliverpool CC BY-SA 3.0