does anyone know how to test a recursive bianry search to check if it works

Recommended Answers

All 3 Replies

I think that you are asking for help in seeing that your function actually goes through all the steps of binary search on a list. Why don't you create a small test list and place a print statement in your code that displays the sublist that is sent back to the function at each recursive call. Since the list is small you can easily tell what the proper search path should be. If the output is what you should be seeing then it is likely that your code works.

ur link didnt help but ive solved it thx

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.