Current location: Hot Scripts Forums » Programming Languages » C/C++ » Binary Search How to have just number argument

Binary Search How to have just number argument

 
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-27-09, 12:46 PM
Hamed Hamed is offline
Wannabe Coder
 
Join Date: Jan 2007
Posts: 169
Thanks: 0
Thanked 0 Times in 0 Posts
Binary Search How to have just number argument

I know this code for binary search
Code:
int search(int a[], int key, int low, int high) {
    if (high < low) {
        return NOT_FOUND; 
    }
    int mid = (low + high) / 2;
    if (key>a[mid]) {
        return searchName(a, key,low, mid-1);
    } else if (key<a[mid]) {
        return searchName(a, key,mid+1, high);
    } else {
        return EXIT_SUCCESS; 
    }
    return ERROR_SEARCH;
}
Now I want to make recursive one which just need
int search(char *dict, char *name,int length,int compChars)
and length is number element in array.
please help me.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Share on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
 

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Search () & regex exact number. Snowball JavaScript 2 03-03-08 11:06 AM
Guaranteed number 1 ranking on a very popular search engine and It's free, no cost. grgx General Advertisements 0 02-16-05 08:21 AM
SEO Expert Available nakulgoyal Job Offers & Assistance 2 08-14-04 01:38 PM
Declared Functions skipper23 PHP 4 12-17-03 11:06 AM
index page not showing up skipper23 PHP 3 12-15-03 02:10 PM


All times are GMT -5. The time now is 08:09 AM.
vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.