| Forums.Sureshkumar.net : A Perfect Place to Share Knowledge Blogs Games Magazines |
|
|
#1 (permalink) |
|
Member
Join Date: Jul 2007
Age: 26
Posts: 47
Thanks: 0 Thanked 1 Times in 1 Posts Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 2
|
binary Search
hi frieds,
I am facing problem in Binary Search my code is under following int binarySearch(byte[] a, byte key) { int low=0; int hi=a.length -1; int mid=0; while(low<=hi) { mid= (low+ hi)>>1; final byte d= a[mid]; if (d==key) return mid; else if (d>key) hi=mid-1; else low=++mid; } return -mid -1; } please check it and why it is not working, if u have code , please give me. |
|
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Search Engine Sites | yathish | Search Engine Optimization (SEO) | 2 | 23-07-07 08:13 PM |
| What is binary search, traversal, hashing? | pooja.22 | ds. c , c++ Interview / Technical Questions | 0 | 23-01-07 08:50 PM |
| How To Design A Search Engine Friendly Website | vjsreevs | Search Engine Optimization (SEO) | 7 | 24-09-06 11:52 AM |
| INTERNET SESSION-3 (for newbies) | wizkid | NETWORK ADMINISTRATION , HARDWARE & TROUBLESHOOTING | 0 | 22-07-06 01:59 PM |
| INTERNET SESSION-2(for newbies) | wizkid | NETWORK ADMINISTRATION , HARDWARE & TROUBLESHOOTING | 0 | 21-07-06 03:22 PM |