Issue 3 in geneticalgorithmtemplates: Binary search wrong

2 views
Skip to first unread message

codesite...@google.com

unread,
Apr 8, 2011, 8:15:14 PM4/8/11
to geneticalgor...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 3 by spoon.re...@gmail.com: Binary search wrong
http://code.google.com/p/geneticalgorithmtemplates/issues/detail?id=3

In MGalgo.h
(https://code.google.com/p/geneticalgorithmtemplates/source/browse/trunk/MGalgo.h),
the documentation for binary_search() in the comments clearly says that
when "target < list[start]", then it returns "start-1". However, if you
call binary_search(target, li) on any sorted list and any target less than
the start of the list (which subsequently calls binary_search_norecurse()
with start=0 and end=li.size()-1), it will never return start-1 (which is
-1), always returning 0.

codesite...@google.com

unread,
Apr 9, 2011, 5:48:01 PM4/9/11
to geneticalgor...@googlegroups.com
Updates:
Owner: craig.ni...@gmail.com

Comment #1 on issue 3 by craig.ni...@gmail.com: Binary search wrong
http://code.google.com/p/geneticalgorithmtemplates/issues/detail?id=3

I'll look into it. Thanks for the report.

codesite...@google.com

unread,
Apr 9, 2011, 5:52:02 PM4/9/11
to geneticalgor...@googlegroups.com
Updates:
Status: Accepted

Comment #2 on issue 3 by craig.ni...@gmail.com: Binary search wrong
http://code.google.com/p/geneticalgorithmtemplates/issues/detail?id=3

(No comment was entered for this change.)

geneticalgor...@googlecode.com

unread,
Apr 10, 2011, 7:01:18 PM4/10/11
to geneticalgor...@googlegroups.com
Updates:
Status: Fixed

Comment #3 on issue 3 by craig.ni...@gmail.com: Binary search wrong
http://code.google.com/p/geneticalgorithmtemplates/issues/detail?id=3

This issue was closed by revision r21.

Reply all
Reply to author
Forward
0 new messages