Bifalgorithm post
Hello everyone, let's understand binary search. So we have these elements with us and we need to find the element too. So what we do, we use to compare this element to the middle element. If the middle element is greater, then we will search at the left hand side. If the middle element is less, we'll search on the left hand side. So we compare 2 with 5. 2 is less than 5. So we will discard the right side elements and these elements are left with us. Now the right most element, right middle element will be our middle element. We will compare 2 with 3. 2 is less than 3. So we will compare on the left hand side. Now we have 1 and 2 with us. We will compare 2 with 2 as our 2 is equals to 2 so we know that we have found our element.
Hello everyone, let's understand binary search. So we have these elements with us and we need to find the element too. So what we do, we use to compare this el…
Ideas in this flowchart
- Binary Search Process
- Initial Setup
- Elements List
- Target Element
- Search Process
- Compare with Middle Element
- Middle Element Greater
- Search Left Side
- Middle Element Less
- Search Right Side
- Middle Element Equals Target
- Element Found