Search an element in sorted and rotated array( Find PIVOT)

  Рет қаралды 29,030

Vivekanand Khyade - Algorithm Every Day

Vivekanand Khyade - Algorithm Every Day

Күн бұрын

Пікірлер: 62
@riteshparkhi8582
@riteshparkhi8582 4 жыл бұрын
Great video. One very important point I realized that for finding mid we should use start + (end -start)/2 instead of (start + end)/2. This will help to handle int overflow error when array is big.
@ankitranjan88
@ankitranjan88 3 жыл бұрын
Thank you ... you are doing great job for us...smoothly explained even all the smallest term to heighest term...
@swastikkanjilal2829
@swastikkanjilal2829 4 жыл бұрын
Sir you are great in explaining these concepts!
@fathimasyed4232
@fathimasyed4232 4 жыл бұрын
Thank you so much .. Really helpful .. Slow and steady, so it is understandable even for beginners..Thanks a lot.
@MargulanTukhfatov
@MargulanTukhfatov 4 жыл бұрын
Please continue posting videos, very good explanation
@praveenchouhan6388
@praveenchouhan6388 4 жыл бұрын
awesome explaination!!!!!!!!!!!!!!
@munishkumararora6429
@munishkumararora6429 5 жыл бұрын
Great explanation for pivot element. Thanks
@SunilKumar-cu8wm
@SunilKumar-cu8wm 5 жыл бұрын
Hi Vivekananda, please change the condition where a[s] > a[mid] here it should be a[s] < a[mid] to select the portion from "s" to "m-1"
@nishantsaxena7500
@nishantsaxena7500 5 жыл бұрын
nahi brother , it is right .. recheck it bro..thoda ghumakar likha h .. par sahi hai..
@payalsagar1808
@payalsagar1808 4 жыл бұрын
@@nishantsaxena7500 I agree with sunil
@maheswarreddyu
@maheswarreddyu 6 жыл бұрын
will this algorithm work when the array has either 1 or 2 elements?
@mikelee5691
@mikelee5691 7 жыл бұрын
thanks. can you please do serialising/deserialising a string to a binary tree?
@akyt7595
@akyt7595 5 жыл бұрын
Great explanation sir. Thank you!
@ManishaKumari-yv3nf
@ManishaKumari-yv3nf 4 жыл бұрын
Thanks😊 for the effort ur putting in. They're very helpful
@karthikk1172
@karthikk1172 5 жыл бұрын
Great Explanation. Never stop making videos.
@payalsagar1808
@payalsagar1808 4 жыл бұрын
Thankyou Vivek ! great 👌got it
@duredurrani
@duredurrani 4 жыл бұрын
Nice explanation
@priyaranjanPanda93
@priyaranjanPanda93 5 жыл бұрын
Do mention also , how to go about duplicate elements in the array. Nice explanation anyways !!
@LakshyaK_SE_
@LakshyaK_SE_ 3 жыл бұрын
is this code correct when we have duplicate elements in a array?
@sammanluitel3018
@sammanluitel3018 7 жыл бұрын
. Given a binary string (e.g. 01, 101, 011), in each iteration 0 becomes 01 and 1 becomes 10, find kth character in the string after nth iteration simple approach, time complexity, express time complexity in terms of n only efficient approach, explanation, time complexity. can u please make a video to solve this problem
@FactifyFables1234
@FactifyFables1234 4 жыл бұрын
try to give clear description sir
@RahulKumar-qu1if
@RahulKumar-qu1if 4 жыл бұрын
Thank you sir!
@sravankumar4750
@sravankumar4750 6 жыл бұрын
can u make a video on shuffle a deck of cards in array or randomize a given array
@lokeshsistu9996
@lokeshsistu9996 3 жыл бұрын
Sir please make videos on timecomplexity
@gayatrijoshi5951
@gayatrijoshi5951 4 жыл бұрын
You are amazing man🙌🙌👏👏
@Dragondavid
@Dragondavid 6 жыл бұрын
You are the best
@helloyou4233
@helloyou4233 6 жыл бұрын
i like your videeeos sir... plz keep making videos
@bhaskarnaik5842
@bhaskarnaik5842 2 жыл бұрын
Thanks
@yuanhe9890
@yuanhe9890 6 жыл бұрын
Thanks, I've always looked at ur utube explanations. They are great and saved me a lot of effort. But please have a better mic LOLOL
@nidhisingh25_
@nidhisingh25_ 4 жыл бұрын
thank you
@isonal2099
@isonal2099 7 жыл бұрын
Vivekanand ji. There is no link in description bar of this video.
@vivekanandkhyade
@vivekanandkhyade 3 жыл бұрын
I will put it.
@karthikperavelli1735
@karthikperavelli1735 5 жыл бұрын
A[]={16,15,14,13,12,11,10,8,7,6,3,2}; what if i pass this extreme case, it returns (m+1), while ans is 11 ??
@avinashkaushik2313
@avinashkaushik2313 3 жыл бұрын
owsome
@amandeepchilani3999
@amandeepchilani3999 5 жыл бұрын
Great Job Vivek..
@Shini1984
@Shini1984 4 жыл бұрын
What if arrays contains duplicates?
@knightganesh
@knightganesh 7 жыл бұрын
Hi the video is awesome and super easy to understand, keep it going. Small suggestion : - But kindly record with a better mic as there seems to be lot of noise in the background.
@vikrantkumarsmvdu
@vikrantkumarsmvdu 6 жыл бұрын
Hi Vivekanand, Please upload videos on different sorting algorithms.
@Saurabhnaik
@Saurabhnaik 7 жыл бұрын
Thanks a lot for great explanation. Please make a video on removing duplicate elements from Array Thanks in advance...
@SEVERANCE850
@SEVERANCE850 7 жыл бұрын
implementation of heap
@pankajverma892
@pankajverma892 4 жыл бұрын
Let us assume that m came 8 than algo will not work bro....
@rrsonia10
@rrsonia10 5 жыл бұрын
whats space complexity?
@dhruvajuloori4361
@dhruvajuloori4361 6 жыл бұрын
Finding an element is nothing but finding a minimum element in the array
@bhavyanayyer3391
@bhavyanayyer3391 4 жыл бұрын
sir can u pls provide with a code it will be very grateful
@FactifyFables1234
@FactifyFables1234 4 жыл бұрын
sir please include in python language please sir
@tyler_ua6593
@tyler_ua6593 6 жыл бұрын
And space complexity is O(n) -> for recursive call stack.
@piyushpatelsrm
@piyushpatelsrm 6 жыл бұрын
boom
@bhavyanayyer3391
@bhavyanayyer3391 3 жыл бұрын
#include using namespace std; int findindex(int s ,int e,int arr[]) { int m = s+e/2; if(arr[m]>arr[m+1]) { int pivot; pivot=m+1; return pivot; } else if (arr[s]>arr[m]) { findindex(s,m-1,arr); } else { findindex(m+1,e,arr); } } int binarysearch(int s , int e ,int arr[], int ele) { int mid = (s + e)/2; while (s
@AshishShukla6
@AshishShukla6 6 жыл бұрын
Good explanation but speed in too slow, many repeatation, 10 to 15 min is sufficient
@tyler_ua6593
@tyler_ua6593 6 жыл бұрын
You can increase the speed of the video. By clicking on the wheel on the right bottom
@harsh4002
@harsh4002 5 жыл бұрын
m = s + (e-s)/2
@SimplyByNP
@SimplyByNP 5 жыл бұрын
Harsh Baheti can you explain why this way is better than (s + e) / 2
@ajay06bce012
@ajay06bce012 4 жыл бұрын
Play at 1.5 times the speed and thank me later!
@adityavashisth495
@adityavashisth495 6 жыл бұрын
wrong approach: cant solve even simple test cases. Suppose if my array is: 9,12,15,1,2,38,40,42,22,45,50,55. Now according to your algorithm mid index is 5 here and arr[s]=9 < arr[m]=38 , so according to your algo it will move to else part and search for PIVOT after 38. But PIVOT is arr[4] which is before 38. So wrong approach.
@varunrao3349
@varunrao3349 5 жыл бұрын
this isn't a sorted rotated array
@ShujathHussain0
@ShujathHussain0 5 жыл бұрын
take a circular sorted array and play using the algorithm
@lachlangro
@lachlangro 4 жыл бұрын
@@varunrao3349 I agree. It has two pivots. 9 and 1 at indexes 0 and 3 respectively.
@lachlangro
@lachlangro 4 жыл бұрын
His algorithm is not foolproof as is. It should first check the start element against the end element to detect whether the array is simply a sorted array with no rotations. It can also fail in situations where duplicates exist such as: 5, 1, 3, 5, 5, 5, 5, 5, 5, 5, 5. keep in mind that i could have placed the 1, 3 in either half of the array. In cases like this linear search may have to be used.
@rahulkhandelwal46578
@rahulkhandelwal46578 6 жыл бұрын
Thanks
Leader in an Array (Code / Algorithm)
15:24
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 21 М.
Search an element in sorted Matrix( row and column sorted)
11:09
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 22 М.
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 11 МЛН
Миллионер | 2 - серия
16:04
Million Show
Рет қаралды 1,6 МЛН
Lowest common ancestor of two nodes in Binary Tree Algorithm
13:49
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 57 М.
Search in rotated sorted array | Leetcode #33
13:52
Techdose
Рет қаралды 83 М.
8. Minimum number in Sorted Rotated Array with variations of question-Practise Binary Search with me
13:18
BS-4. Search Element in Rotated Sorted Array - I
16:38
take U forward
Рет қаралды 276 М.
Zig Zag Array (spiral order array)
10:44
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 40 М.
LeetCode 33. Search in Rotated Sorted Array
9:30
Nick White
Рет қаралды 98 М.
Print Matrix Diagonally (Diagonal order)
13:22
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 110 М.
ROTATION of an array (REVERSAL Algorithm)
7:52
Vivekanand Khyade - Algorithm Every Day
Рет қаралды 51 М.