Hello people, I know how simple binary search works, but how can I do a double binary search, we got students each with a name and a code, I need in my binary search to find a student by name AND by code, using ONLY binary search.How could I do that ???
Please, I don't see how to express the binary search algorithm that is going to exclude another student, with the same name, but a different code.
Please help me, it's very urgent.
It's in C++, just the idea.
comply or die
0
Newbie Poster
Recommended Answers
Jump to PostThe comparisons are not limited to just one field within a class or structure, you can compare as many class objects such as strings that you want to. In the comparison, if the two names being compared are the same then compare the code.
Jump to PostInstead of me guessing, what is it that you are trying to search? An array of structures or classes, a linked list, or what ?
All 8 Replies
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
comply or die
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
comply or die
0
Newbie Poster
VernonDozier
2,218
Posting Expert
Featured Poster
Alex Edwards
321
Posting Shark
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.