Binary Search Algorithm C++ Code in Data Structures | Part -2 | DSA

  Рет қаралды 46,190

Simple Snippets

Simple Snippets

Күн бұрын

Пікірлер: 61
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
Hey Guys, if you want more such tech educational videos on this channel then please support me by subscribing to this channel & also share it with your friends as it helps me create more content just for you ✌
@Shivani-ss6ks
@Shivani-ss6ks 4 жыл бұрын
Please, do complete the whole series.. it's a feast for hungry people who actually want to learn ..
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Hehe will try. However these videos are very difficult to make at a faster pace. Hope you understand ✌️
@DemX_HaX
@DemX_HaX 4 жыл бұрын
I love how you explain things very thoroughly and simply. It's wonderful for people like me who want to properly understand subjects like these. If you can, it would be wonderful to see a tutorial series that use the programming principles you teach us for a small scale project. Maybe a simple game or app so we can see how this all comes together. :)
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you so much for the wonderful compliments. And yes loved your suggestion as well. Will see if I can make something out of it!
@nishanty7392
@nishanty7392 3 жыл бұрын
Kudos to the huge Efforts you have put through in making all these videos. You're such a Gem Person brother and I seriously Thank you for such free valueable content. Wish I could found you earlier. Thank you once again.❤️
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thanks a ton! Thats really great to know buddy🙏 Please support me by sharing the videos and our channel with your friends too. Thats the biggest help and support you can provide 😇
@zainabbohra2915
@zainabbohra2915 3 жыл бұрын
Amazing bhai😎😎,and yess your accent is also very crystal and clear like your way of explaining 😅
@divyansh34
@divyansh34 2 жыл бұрын
This channel is underated
@ankushraj9583
@ankushraj9583 3 жыл бұрын
underrated channel. you deserve a lot more audience.
@SimpleSnippets
@SimpleSnippets 3 жыл бұрын
Thanks Ankush 🙌 bas aap share karogey toh help hogi 🤘
@nafisahmed3607
@nafisahmed3607 3 жыл бұрын
Maaaaaaaan why only 156k???? Why????? How on earth isn't this channel 1M yet????? Bhai when u get time after all your works make a video on Binary Search using recursive function
@ubaidullah1991
@ubaidullah1991 Жыл бұрын
extremely helpful
@HASHBIT70532
@HASHBIT70532 2 жыл бұрын
Awesome bro
@sriramadithya4799
@sriramadithya4799 3 жыл бұрын
Thanks 😊
@osamamustafa6884
@osamamustafa6884 4 жыл бұрын
Respected Mr Tanmay Kindly Please do it with recursive function kindly
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Thank you Osama, will keep this noted. ✌
@dishanamdev2620
@dishanamdev2620 4 жыл бұрын
Plz tell how to use recursive func in binary search( where is the video )
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
In this approach we are not using recursive approach. We are using iterative approach 😇
@dishanamdev2620
@dishanamdev2620 4 жыл бұрын
Why we can't use mid as mid = right+left/2 instead of left +(right -left)/2
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
You should try to use this. I think it will work. Try to dry run in step by step. ✌
@dishanamdev2620
@dishanamdev2620 4 жыл бұрын
@@SimpleSnippets ok thanks
@bodlahruthik5730
@bodlahruthik5730 4 жыл бұрын
@@SimpleSnippets actually if we take the lcm of that expression we will get to a simplied form of (left + right)/2.then why it is required to deal with such complicated one .
@mebton
@mebton 4 жыл бұрын
right+left/2 = left+(right-left)/2 cuz mid = left+(right-left)/2 if we multiply by 2 2mid=2left+(right-left) 2mid=left+right mid=(left+right)/2
@newtechnology452
@newtechnology452 4 жыл бұрын
sir, please make a video on binary tree
@nitismita1035
@nitismita1035 2 жыл бұрын
❤❤❤
@expert77
@expert77 11 ай бұрын
@adilshaikh9123
@adilshaikh9123 Жыл бұрын
in case of dynamic array creation...when the value in array is [1] and the target element to search is also 1 ....then the program should return output as "0" which is mid value but instead it's returning "-1". Can you please help me with this test case? The code to refer : class Solution { public: int search(vector& nums, int target) { //int temp = target; int left = nums[0]; int right = nums.size()-1; while(left
@venkateshprasads8361
@venkateshprasads8361 3 жыл бұрын
sir plz put Fibonacci search video tutorial
@25fpslagger81
@25fpslagger81 2 жыл бұрын
I have a doubt, wont we need to define what's int left and int right(like int left = 0 and int right = 9 in this case)? how did the computer understand that we are referring to extreme positions? Ok wait I got it thanks anyways
@abhimanyu6534
@abhimanyu6534 3 жыл бұрын
Plz make it using recursion 🙏🙏🙏🙏🙏🙏🙏🙏🙏
@ganeshvategaonkar351
@ganeshvategaonkar351 4 жыл бұрын
Make it for recursive function please..
@jhovaniprovida5121
@jhovaniprovida5121 5 жыл бұрын
We combine stack and queue how can i use binary search to search inside stack and queue?
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
binary search can be implemented provided the Data Structure already has sorted elements in it :-)
@jhovaniprovida5121
@jhovaniprovida5121 5 жыл бұрын
Yes my code also had three types of sorting bubble, insertion, and selection sort so im asking how can i add binary search in my code.
@rajatverma3205
@rajatverma3205 4 жыл бұрын
How to use binary search in Linked list ?
@shwetpandey1250
@shwetpandey1250 3 жыл бұрын
what I do when multiple same element search into the array
@vipinkiruba102
@vipinkiruba102 4 жыл бұрын
Plz puta video on recursive function too
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
I already have covered it in my C++ programming for beginners playlist. Here is that video - kzbin.info/www/bejne/mWi5m4Ztj7-Jja8
@vipinkiruba102
@vipinkiruba102 4 жыл бұрын
@@SimpleSnippets plz put a video on binary search using recursive function
@pritammajumdar4975
@pritammajumdar4975 4 жыл бұрын
@@vipinkiruba102 Recursive Way int binarySearch(int arr[ ], int l, int r, int no){ while(l arr[mid]) return binarySearch(arr, l + 1, r, no); else return binarySearch(arr, l, r - 1, no); } return -1; }
@poonamsangale4037
@poonamsangale4037 3 жыл бұрын
How to improve coding logic?
@kavyatripathi2151
@kavyatripathi2151 4 жыл бұрын
what if array descending order mai ho?
@SahilBhosale08
@SahilBhosale08 3 жыл бұрын
Hi Tanay Sir, I have a doubt as you have taken the length of array here 10 so as while passing values in function you gave left value as 0 and right as 9 but what if we are taking array from user we wouldn't know the right value at this scenario what value should be passed can u clear my doubt
@yogeshkanare6312
@yogeshkanare6312 2 жыл бұрын
if size of array is n then take right =n-1
@lokibaba4836
@lokibaba4836 5 жыл бұрын
How to write programme using recursive functions???
@SimpleSnippets
@SimpleSnippets 5 жыл бұрын
Check this video - kzbin.info/www/bejne/mWi5m4Ztj7-Jja8
@mohithvarigonda9516
@mohithvarigonda9516 4 жыл бұрын
what is the logic to print the numbers if repeated more than one time
@vijaysinghchauhan7079
@vijaysinghchauhan7079 4 жыл бұрын
Please 🙏 upload Binary Search using recursive function.
@SimpleSnippets
@SimpleSnippets 4 жыл бұрын
Yes the next few videos will be with recursive functions for traversal and search
@7cipher399
@7cipher399 3 жыл бұрын
int binarySearch(int arr[ ], int l, int r, int no){ while(l arr[mid]) return binarySearch(arr, l + 1, r, no); else return binarySearch(arr, l, r - 1, no); } return -1; }
@LyricVista
@LyricVista 4 жыл бұрын
sir i have write this code and its very helpful, i have one question that when we take array from user dynamically then is their any change in the code? like my code is exactly same like yours but i just take arrays elements from user dynammically, so problem is that the output is not same like your. in main function the output par shows some type of error and donot print the position can you please solve this. int main() { int size; int *array; cout
@srushtivariya1231
@srushtivariya1231 2 жыл бұрын
Actually u have taken only 3 argumentd in binarysearch function u haven't taken left i.e lower boundary
@dhonddevameya2362
@dhonddevameya2362 4 жыл бұрын
Sir if we are given a random array , then how to convert it to a sorted one?
@omkarshinde7355
@omkarshinde7355 3 жыл бұрын
first you have to sort random array by bubble sort or any sorting method then you can apply this algorithm
@swcomparisons8386
@swcomparisons8386 2 жыл бұрын
array.Sort( );
@tushar9548
@tushar9548 4 жыл бұрын
Bro I took the int size instead of taking 10..but when I started inputing my values in Array,it only took first 8 values as input.. Then I changed size to 15,20 etc. But it always took only 8 elements as input..what is the reason and how can I fix this? (I am using DEV C++)
@siciliancpp382
@siciliancpp382 4 жыл бұрын
use vs code,clion .. dev cpp is outdated n doesnt supp for cpp17,20
@mohithvarigonda9516
@mohithvarigonda9516 4 жыл бұрын
check your logic no problem with dev c++
@thestarinthesky_
@thestarinthesky_ Жыл бұрын
These videos on Binary Search lacks the important part : explanations on the time and space complexity.
@gamsterilyass2952
@gamsterilyass2952 3 ай бұрын
❤❤❤❤
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 24 МЛН
😜 #aminkavitaminka #aminokka #аминкавитаминка
00:14
Аминка Витаминка
Рет қаралды 3 МЛН
龟兔赛跑:好可爱的小乌龟#short #angel #clown
01:00
Super Beauty team
Рет қаралды 135 МЛН
Wait for it 😂
00:19
ILYA BORZOV
Рет қаралды 11 МЛН
My 2 Year Journey of Learning C, in 9 minutes
8:42
VoxelRifts
Рет қаралды 644 М.
Binary Search Algorithm | C Programming Example
11:41
Portfolio Courses
Рет қаралды 58 М.
Insertion Sort Algorithm C++ Code in Data Structures | Part -2 | DSA
11:12
C++ Programming: Binary Search Algorithm
14:53
ReelLearning
Рет қаралды 221 М.
C++ Programming: Linear Search Algorithm
14:14
ReelLearning
Рет қаралды 175 М.
Elza love to eat chiken🍗⚡ #dog #pets
00:17
ElzaDog
Рет қаралды 24 МЛН