Find if there is a pair with a given sum in a sorted and rotated array | GeeksforGeeks

preview_player
Показать описание


This video is contributed by Aditi Bainss

Please Like, Comment and Share the Video among your friends.

Also, Subscribe if you haven't already! :)
Рекомендации по теме
Комментарии
Автор

you have a big name in IT industry and this is your explanation

mrinalchoudhary
Автор

pls give full explation of program, it is all written in geeksforgeeks page so why we need to see video tutorial if it cant help

shubhamtiwari
Автор

nice explanation, i didnt uderstand single thing except the question

vivekantill
Автор

bro can u elaborate your logic please..??

sainisaab
Автор

array = 8 20 28 1 12 4 13 4
sum = 8

the answer given by this algo is false although 4+4 = 8 present in the array
can anyone explain if I'm wrong with the code:-

in this k is the sum

bool find(in arr[], in n, in k){

in mask = n-1;
loop(i, n-1){
if(arr[i] > arr[i+1]){
mask = i; break;
}
}

in l = mask+1;
in r = mask;

while(l != r){
if(k == arr[l] + arr[r]) return true;
else if(k > arr[l] + arr[r]) l = (l+1)%n;
else r = (n+r-1)%n;
}

return false;

}

tushargupta
Автор

how we are looking to uhh we also having a big big eyes bro we can also see the code...

ajajith
Автор

He to humko website pn bhi samaj aagaya kuch aur batoa yaar dont do this gfg i love your webiste ...dont disappoint us

gayatri
Автор

it's wrong coding giant. If there are even number of elements then l and r will never meet.

abhinavanand
Автор

whats the point of making this video if you are reading the code as it is ?

mylearnings
Автор

you just read that code ..
i can explain it much better than you bro ....such a shame for geeks for geeks .
how they heir you bro ..

yaash.guptaa