Skip to content

Update 06 sparse_search.cpp #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 04 Sorting & Searching/06 sparse_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ int sparse_search(string a[],int n,string key){
int e = n-1;
while(s<=e){
int mid = (s+e)/2;
int mid_left = mid - 1;
int mid_right = mid + 1;
if(a[mid]==""){
int mid_left = mid - 1;
int mid_right = mid + 1;
while(1){
if(mid_left<s and mid_right>e){
return -1;
Expand Down
1 change: 1 addition & 0 deletions 05 Binary Search/kpartition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ int k_partition(int arr[],int n,int k){
for(int i=0;i<n;i++){
e += arr[i];
}
e=e/k;
//mid
int mid;
int ans;
Expand Down