Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in C only
Search
Advanced Search
Forums
BYTES
Product Launch
Updates
Developer Toolkit
Today's Posts
Member List
Calendar
Home
Forum
Topic
C
Does a binary search work for odd number of elements ?
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
JUNAYED HOSSAIN
New Member
Join Date:
Nov 2017
Posts:
1
#1
Does a binary search work for odd number of elements ?
Nov 15 '17, 06:15 AM
Is binary search work for odd number OF element ?
weaknessforcats
Recognized Expert
Expert
Join Date:
Mar 2007
Posts:
9214
#2
Nov 15 '17, 06:38 AM
Yes. But you must always be sure to set your range correctly. Your end marker must point to one past the end element and not at the element itself or you will lose the end element in the search.
Comment
Post
Cancel
donbock
Recognized Expert
Top Contributor
Join Date:
Mar 2008
Posts:
2427
#3
Nov 15 '17, 11:30 AM
Are you using the stdlib
bsearch()
function or are you writing your own binary search function?
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment