|
-
February 19th, 2009, 02:47 PM
#6
Re: Binary Search Problem
No. The frustrating thing is that as I said I already debugged everything. I was well aware in fact EXACTLY aware of what was causing the infinite loop. I should have been more clear about this. My mistake.
There wasn't even any need to trace it out. I knew 100% that the problem was caused by low = mid and high = low + 1 = mid + 1.
The problem is I can't figure out how to modify the search to fix the problem. Everytime I modify things by adding or subtracting 1 to the conditions or assignments it causes errors on different ends of the binary search.
Can't find a clean fix that patches up this problem. But as I said, yes I have debugged and I know what's causing the infinite loop. I'm just looking for a solution as to how to fix it.
Also, I appreciate the sentiment of trying to get me to figure out the solution myself but:
A. I'm not a student. this isn't homework
B. I've been hacking at this forever and if someone could just provide a solution it would relieve what feels like a century long headache.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|