Learn Linear Search in 3 minutes ⬇️
94,939
Published 2021-10-16
#linear #search #java
All Comments (21)
-
public class Main{ public static void main(String args[]){ // linear search = Iterate through a collection one element at a time int[] array = {9, 1, 8, 2, 7, 3, 6, 4, 5}; int index = linearSearch(array, 5); if(index != -1) { System.out.println("Element found at index: " + index); } else { System.out.println("Element not found"); } } private static int linearSearch(int[] array, int value) { for(int i = 0; i < array.length; i++) { if(array[i] == value) { return i; } } return -1; } }
-
bro just casually explained my whole 1 hour class lmao
-
I am going through Cyber security school currently. The texts are very long and complicated in a reading format, yet here you are teacher better than my text books. Thank you, you've helped me understand and grasp a lot this last year.
-
Didn't you just post this poll like two days ago? you really are one of the best coding tutorial channels out there man, keep it up.
-
Love your series, very concise and clear!
-
As always clear and easy to follow tutorial on something that will be very useful. Thanks Bro. 👍👍
-
Randomly encountered this channel some time ago , got hooked to the some-programming-language-in-an hour vids and now discovered that bro also does DSA... now cramming for a tech interview
-
Its a very informative video, great job.
-
Very clear bro. Thanks a lot.
-
Very nice tutorial as always!!! Is there any way to see if there another index with the same value?
-
thank you, keep going please
-
POV my goal is to have a little heart from Bro code. POV is not a POV.
-
very well done.
-
Man that Gigachad icon truely sets for you.
-
Thanks, Bro!
-
Thank you so much 💓 صلوا على رسول الله ❤
-
Cool bro
-
Do u know what kind of search algo is used by big websites like youtube, facebook, twitter etc??? Thanks for the videos btw, I have definitely learnt alot!
-
Thanks!
-
Lol you just liked my comment for more java algorithms and data structures and you posted this video😍🥰