Learn Interpolation search in 8 minutes ❓

  Рет қаралды 44,854

Bro Code

Bro Code

Күн бұрын

Interpolation search data structures and algorithms tutorial example explained
#interpolation #search #java

Пікірлер: 52
@BroCodez
@BroCodez 3 жыл бұрын
public class Main{ public static void main(String args[]){ //interpolation search = improvement over binary search best used for "uniformly" distributed data // "guesses" where a value might be based on calculated probe results // if probe is incorrect, search area is narrowed, and a new probe is calculated // average case: O(log(log(n))) // worst case: O(n) [values increase exponentially] int[] array = {1, 2, 3, 4, 5, 6, 7, 8, 9}; int index = interpolationSearch(array, 8); if(index != -1) { System.out.println("Element found at index: "+ index); } else { System.out.println("Element not found"); } } private static int interpolationSearch(int[] array, int value) { int high = array.length - 1; int low = 0; while(value >= array[low] && value
@joyceasante8292
@joyceasante8292 Жыл бұрын
Practicing... import java.util.*; public class Main { public static void main(String[] args) { int[]array = {1,2,4,8,16,32,64,128,256,512,1024}; int index = interpolationSearch(array,1024); if(index != -1){ System.out.println("Element found at index: "+ index); } else{ System.out.println("Element not found"); } } private static int interpolationSearch(int[]array, int value){ int high = array.length - 1; int low = 0; while(value >= array[low] && value
@mikedabramo2001
@mikedabramo2001 9 ай бұрын
I'm transitioning out of teaching into programming/IT, and the biggest obstacle I've faced so far is learning from someone who can explain challenging material in a way that a novice can understand. You obviously know the material, but what sets you apart is your ability to teach it well. Outstanding job!
@nutcoatz6230
@nutcoatz6230 3 жыл бұрын
this guy is the most underrated channel ever, like holy shit this guy is good at teaching, keep it up man don't stop!
@marcovic9916
@marcovic9916 3 жыл бұрын
This search algorithm is crazy, never heard of that! I'll definitely remind this and maybe should tell my prof about. Nice video bro :)
@vovagusse
@vovagusse 3 жыл бұрын
Binary search, *BUT BETTER?!* Thanks! Saving it to my playlist with no hesitations!
@BroCodez
@BroCodez 3 жыл бұрын
better but IF the data is about evenly distributed
@juanivillanueva7873
@juanivillanueva7873 Жыл бұрын
I'm in the third year of my CS career and I have never heard of this type of search!
@Ashish-yq9lg
@Ashish-yq9lg 3 жыл бұрын
Can you make videos with some complex examples where we can code side by side with your videos for like arraylists, searching, sorting etc. That would be really helpful in understanding the use of them in different situations. Anyway Thanks for the free courses 😀
@HpLapTop-f1x
@HpLapTop-f1x Жыл бұрын
Assolomu Alaykum ! Bro your videos so helpfull and better to undestand. Can you give more definations and explanations to probe function ! Thank you ! For free sharing your videos.👌👌👌👌👌👌👌👌
@Dertgyhud
@Dertgyhud 3 жыл бұрын
Can’t believe you are at 200K subscribers. I was one of the first subscribers when you started around November 2019. I went by Dan Savage then.
@emreotu4464
@emreotu4464 17 күн бұрын
Learn Interpolation search in 8 minutes ❓
@gabrielcapone4332
@gabrielcapone4332 3 жыл бұрын
These algorithm videos are great bro :)
@victorrezende6002
@victorrezende6002 Жыл бұрын
Nice class
@omggodbs
@omggodbs 3 жыл бұрын
yo i went from zero to hero cuz of ur content :)
@najmulislam9658
@najmulislam9658 3 жыл бұрын
Thanks Bro, For This Video. You ara A Good Parson. I Like Your Video all time. Your Fan From "Bangladesh".
@oogshow2809
@oogshow2809 3 жыл бұрын
its really nice explanation with quite voice , thanks bro
@neil_armweak
@neil_armweak 3 жыл бұрын
Well done
@DetCoAnimeFan
@DetCoAnimeFan 3 жыл бұрын
Oh, this is something new and interesting. I thought only linear search and binary search existed😅
@cranebird1467
@cranebird1467 3 жыл бұрын
Thanks a lot ! Great job, advanced biSearch.
@BananaMan6763
@BananaMan6763 6 ай бұрын
In these videos where these concepts can be applied to programming you show examples of using them with programming in Java, and it has helped me understand a bit, it’s just that I’m not learning Java, I’m learning c#. Would it be ok for me to look at your examples to understand how the concepts work when applied to programming and then try to learn how to use them with c#?
@emptycode1782
@emptycode1782 2 ай бұрын
these are general stuff and not really restricted to a language , you could apply the same concept and logic throughout other languages and it would be completely fine. actually most other stuff are the same , its rare to find a general concept that doesnt apply to all languages ( Dsa is an example , multithreading basics , data collections , networking , api design , sql basics)
@keithwalter7136
@keithwalter7136 3 жыл бұрын
I love the explanation and I learned a lot. I also would like to learn for 2 or more array factors which we can guess the interpolated value using these given multiple set of arrays. Would love to watch that maybe in the series of this video? Either way, thanks so much bro!
@jaymar921
@jaymar921 3 жыл бұрын
Hello bro, cool vid 😎
@DetCoAnimeFan
@DetCoAnimeFan 3 жыл бұрын
One question, this will work only if array is sorted and the data is either in Geometric progression or arithmetic progression. Will it also work in arithmetic-geometric progression and harmonic progression?
@coder4937
@coder4937 3 жыл бұрын
Try it yourself 🙃
@ricardochica4339
@ricardochica4339 3 жыл бұрын
omg, this algorithm is crazy! Although, I'm not sure if I'm doing this one correctly or what's going on: I'm using an array populated by random elements bound in 200. It has 100000 elements, and they have been sorted. I do this search function as explained but only throws 1 probe, or 2 at the most each time, how is that possible that it guesses almost every time correctly? int[] array3 = new int[100000]; Random random = new Random(); for (int i = 0; i < 100000; i++) array3[i] = random.nextInt(200); Arrays.sort(array3); int interpSearch = 123; int index3 = interpolationSearch(array3, interpSearch); System.out.println(); if(index3 != -1) { System.out.println("Element found at index: " + index3); System.out.println("Array index: " + index3 + "\tValue:" + array3[index3]); } else System.out.println("Element not found"); } And here's the method: private static int interpolationSearch(int[] array, int value){ long start; long end; long elapsed; start = System.nanoTime(); int high = array.length - 1; int low = 0; while(value >= array[low] && value
@MrLoser-ks2xn
@MrLoser-ks2xn Жыл бұрын
Thanks!
@TheEvertonDias
@TheEvertonDias Жыл бұрын
Thanks, Bro!
@yaboijones
@yaboijones 2 жыл бұрын
can someone explain to me how probing works? how does the formula guess where the value is?
@eugenezuev7349
@eugenezuev7349 3 ай бұрын
sweeeet
@oogshow2809
@oogshow2809 3 жыл бұрын
bro one request we need class of 3d game developement in java
@princeangelo7051
@princeangelo7051 3 жыл бұрын
❤️❤️❤️ first to see ❤️❤️
@thealmightytitan4006
@thealmightytitan4006 3 жыл бұрын
no I was
@typingcat
@typingcat 11 ай бұрын
What exactly does "uniformly distributed" mean here? The example series seem only increasing. What's uniform? You mean, increasing by a fixed rate?
@Starbreaker14
@Starbreaker14 10 ай бұрын
Correct
@thealmightytitan4006
@thealmightytitan4006 3 жыл бұрын
thanks
@ucPham-yq2qy
@ucPham-yq2qy 8 ай бұрын
but when arr[low] == arr[high] and low != high, how this search algorithm work?
@marcel_wendler
@marcel_wendler 3 жыл бұрын
As what are you working?
@manangautam6797
@manangautam6797 3 ай бұрын
but ho do we get that formula of probe?
@Kn17tybn
@Kn17tybn Жыл бұрын
Does anybody know where I can find a proof of the average case?
@maccollo
@maccollo 8 ай бұрын
It's basically the secant method, so you should probably look for proofs regarding it's convergence rate. For sufficiently large datasets you can treat it the same as finding the root of a real valued functions in the interval [0,1], and find how many steps until the error is < 1/n
@pogchamp2973
@pogchamp2973 3 жыл бұрын
Poggersss
@cedric6941
@cedric6941 3 жыл бұрын
gg
@Nagar2024
@Nagar2024 Жыл бұрын
I think this is giving wrong ans for array {10,20,30,40,50}
@duongpham6112
@duongpham6112 Жыл бұрын
It is working perfectly, check algorithm again.
@shivamthakur1226
@shivamthakur1226 Жыл бұрын
Random Comment
@Trapped8283
@Trapped8283 Жыл бұрын
my brain is defective I cant understand
@fyrukmcoo100
@fyrukmcoo100 3 жыл бұрын
:((
@dhruvkumar-br2lp
@dhruvkumar-br2lp 3 ай бұрын
Thanks
Learn Bubble Sort in 7 minutes 🤿
7:44
Bro Code
Рет қаралды 291 М.
Learn Binary search trees in 20 minutes 🔍
20:25
Bro Code
Рет қаралды 184 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 7 МЛН
Can You Find Hulk's True Love? Real vs Fake Girlfriend Challenge | Roblox 3D
00:24
Увеличили моцареллу для @Lorenzo.bagnati
00:48
Кушать Хочу
Рет қаралды 8 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 119 МЛН
Learn Binary Search in 10 minutes 🪓
10:04
Bro Code
Рет қаралды 125 М.
3 Types of Algorithms Every Programmer Needs to Know
13:12
ForrestKnight
Рет қаралды 501 М.
Learn Recursion in 8 minutes 😵
8:19
Bro Code
Рет қаралды 84 М.
Learn Hash Tables in 13 minutes #️⃣
13:26
Bro Code
Рет қаралды 387 М.
7.1 Linear Search Algorithm | Linear Search in C | Data Structures Tutorials
15:09
Jenny's Lectures CS IT
Рет қаралды 1 МЛН
Binary Search Animated
7:00
Dreams of Code
Рет қаралды 37 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 835 М.
Exponential Search - better than Binary search? (Explained)
11:23
Learn Quick Sort in 13 minutes ⚡
13:49
Bro Code
Рет қаралды 392 М.
Turn Off the Vacum And Sit Back and Laugh 🤣
00:34
SKITSFUL
Рет қаралды 7 МЛН