Function to search ' str ' in ' list2 [ ] ' . If it exists then price associated with ' str ' in ' list2 [ ] ' is being returned else - 1 is returned . Here binary serach technique is being applied for searching
int binary_search ( item list2 [ ] , int low , int high , string str ) { while ( low <= high ) { int mid = ( low + high ) / 2 ;