filmov
tv
Linear Search in 2 min (Python)
Показать описание
In this video, I will explain linear search by demonstrating the algorithm in a program iteratively (using a for loop) and then recursively (using recursion).
The way linear search works is that you have a number that you want to search for in an array or a list. If it exists in the array, you return the location (which is the index) where that number occurs. We call this number "the target". If the target does not exist inside the array, you simply return -1.
What is recursion? Recursion is a function that calls upon itself. Here, we write a function that calls upon itself to linear search an element or value inside an array using a for loop and using recursion. While it is easy to use a for loop or while loop to do this, it is important that you understand these recursion steps to have a strong foundation to learn more complex recursive algorithm in the future.
In the next video, I will explain binary search which is very similar to linear search, and I will also explain why it is so useful.
LIKE & SUBSCRIBE:
The way linear search works is that you have a number that you want to search for in an array or a list. If it exists in the array, you return the location (which is the index) where that number occurs. We call this number "the target". If the target does not exist inside the array, you simply return -1.
What is recursion? Recursion is a function that calls upon itself. Here, we write a function that calls upon itself to linear search an element or value inside an array using a for loop and using recursion. While it is easy to use a for loop or while loop to do this, it is important that you understand these recursion steps to have a strong foundation to learn more complex recursive algorithm in the future.
In the next video, I will explain binary search which is very similar to linear search, and I will also explain why it is so useful.
LIKE & SUBSCRIBE:
Linear Search in 2 min (Python)
Learn Linear Search in 3 minutes ⬇️
Linear search
Linear search vs Binary search
Python Linear Search Algorithm in 2 Minutes
Binary Search animated
Learn Linear search algorithm in 2 minutes :0 | #LinearSearchAlgorithm #Algorithm #DataStructures
Linear Search | Engineers Minute
Introduction to AI: Day 2
Algorithms: Binary Search and Linear Search (in 1 minute)
Introduction to Linear Search in Less than 2 Minutes!
1.11 Best Worst and Average Case Analysis
Linear Search | Linear Search in 5 minutes | Explained with example
Linear Search: Iterative and Recursive in 5 Minutes
How to search for an element is an Array using Linear Search??
Insertion sort in 2 minutes
Linear Search using Python | Python Tutorial for Beginners 68
Understanding the Linear Search Algorithm: How to Search through Data
7.1 Linear Search Algorithm | Linear Search in C | Data Structures Tutorials
Binary Search examples | Successful search | Design & Algorithms | Lec-13 | Bhanu Priya
Linear Search Algorithm | Algorithm in Minutes
linear search in 5 minutes
Binary search in 4 minutes
2D Array Linear Search Method
Комментарии