Binary search for the 23rd odd number in C++

  • Context: C/C++ 
  • Thread starter Thread starter icanpartseas
  • Start date Start date
  • Tags Tags
    Binary Search
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
1 reply · 2K views
icanpartseas
Messages
1
Reaction score
0
I have to write a C++ binary search code where it generates the first 100 odd numbers and the search is used to the find the # 23 any help? I am ompletely lost
 
Physics news on Phys.org
If you are completely lost, you are either very modest, didn't go to class, or have no time to do your homework.
You would do well if you read up some background information and post a tentative solution at the appropriate forum for homework help:
https://www.physicsforums.com/forumdisplay.php?f=158

You could either Google "binary search", or try the following links:
http://en.wikipedia.org/wiki/Binary_search
http://www.fredosaurus.com/notes-cpp/algorithms/searching/binarysearch.html

After that, compile the sample program and do some tests. If you have questions about the algorithms, you can post here. For problems related to coding, you can post at the homework help site.

Good luck.