Frequently Asked Java Program 21: Searching an Element in Array | Binary Search

preview_player
Показать описание
Topics :
----------
1) Searching an Element in Array
2) Binary Search

#########################
Udemy Courses:
#########################

Manual Testing+Agile with Jira Tool
************************************

Selenium with Java+Cucumber
********************************

Selenium with Python & PyTest
********************************

Selenium with python using Robot framework
****************************************

API Testing(Postman, RestAssured & SoapUI)
*****************************************

Web & API Automation using Cypress with Javascript
********************************************

Playwright with Javascript
**************************

Jmeter-Performance Testing
************************

SDET Essencials(Full Stack QA)
*************************

Appium-Mobile Automation Testing
************************************

Java Collections
*****************

Python Programming
*********************

Cucumber BDD Framework
***************************

Protractor with Javascript
***************************

####################################
Youtube Playlists:
####################################

Manual Testing & Agile
***********************

SQL
*************************

linux & Shell Scripting
**********************

Java
**********************

Selenium With Java+Cucumber
********************************

Python
********************************

Selenium With Python,Pytest&Behave
***************************************

Selenium With Python Using Robert Framework
(Web&API Testing)
*************************************************

API Testing (Postman,SoapUi,&Rest Assured)
**********************************************

Mobile App Testing Appium
****************************

Performance Testing Jmeter
*******************************

Maven,Jenkins,Git,Github,CI/CD
*******************************

SQL,DB Testing&ETL,Bigdata
*******************************

JavaScript Based Automation Tools
********************************

Selector Hub Tools
********************

GraphQL
******************

Cypress API Testing
********************

Cypress Web Testing
**********************

Playwright with Javascipt
**************************

#PythonArraySearch
#ArrayElementSearch
#PythonSearchAlgorithm
#ArraySearching
#FindElementPython
#ArraySearchTechniques
#PythonSearchMethods
#SearchArrayPython
#ArraySearchTips
#PythonSearchTricks
#ArrayLookup
#SearchInPython
#ArrayQuery
#PythonArrayQueries
#ElementInArray
#PythonSearchTutorial
#ArrayHunting
#SearchLogicPython
#ArrayScan
#PythonArrayMagic
#ElementSeeking
#ArrayHunters
#PythonSearchPointers
#SearchingWithPython
#ArraySniper
#FindInArray
#PythonSearchHacks
#ArraySearchByExample
#PythonArrayQuest
#SearchChallenge
#ArraySleuthing
#PythonSeekAndFind
#ElementQuest
#PythonArrayExpedition
#SearchMastery
#ArrayInvestigation
#PythonSearchExploration
#ElementScout
#PythonArrayPuzzle
#SearchJourney
#ArrayDiscovery
#PythonHuntAlgorithm
#ElementDetection
#PythonArrayTracking
#SearchAlgorithms
#ArraySearchAdventures
#PythonSearchGuides
#ElementTrail
#PythonArraySleuth
#SearchInArrays
Рекомендации по теме
Комментарии
Автор

Person like me who hates coding, Starting like it after watching your video . Your video is so simple and but logical and easy to understand, Thankyou sir

kritikagolhani
Автор

Thank you for full session Sir, it is really helpful, It will be good if you upload frequently asked programs on DS or collections

rachanabr
Автор

This 30 Programming is really Logical Building Program Thank You SO much sir.

yogeshjadhavybj
Автор

Sir.. You are helping us to learn Java programming in simple terms...

mahendranprofessional
Автор

the way your explanation is very clear it is possible only when u thorough in the subject thanks for the explanation

dasareddyudayasandhya
Автор

Thanks a bunch ☺️..
Explanation was crystal clear 👍

syedajaveriyaafreen
Автор

Thank you so much, Sir. You have a gift in explaining complex things!

huayang
Автор

Thank you for explaining coding interview questions line by line and also the logic behind them .I wish i had found this earlier.if possible please explain how to create an web application using spring mvc and please explain the mvc part as in where it is applied in the application.

ManishTronics
Автор

How we can do the same binary search with for loop i tried for( low=0;low<=high;low++)
But output is blank in the console

saiperavarapu
Автор

Thank you so much, by the way, there is a weird whistle in your audio.

glenndelostrico
Автор

Hi, could you please upload video explaining how to achieve, "write java code for //i/p:"aaccbbaadd" //o/p:"2a2c2b2a2d" using for loop

adityat
Автор

add on to previous comment if you set l=0 it will search all the other indexes but if you search number 1 at index [0] it will return not found I set l to -1 and it works fine.

danielhoffman
Автор

is it only working sequential order in array?

shakulhameed
Автор

Using the binary search logic - how can we identify the exact position instead of element found ?

Can let us know sir

vishnuswaroop
Автор

It doesn't work for 1 when you make 1 the key it returns not found

danielhoffman
Автор

What if differences between alternate elements are not same

Mm-ztgk
Автор

Sir why using Boolean= false can explain

sivajikottisa
Автор

Bro u knows
Python
Java
Selinium
Data structures
JavaScript
Sql
U r a full stack developer

veereshchinna
Автор

2nd method is not working, here i have found correct code for it.

import java.util.Arrays;

public class BinarySearch2 {

public static void main(String args[]) {


int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

System.out.println(" found at index = " + Arrays.binarySearch(a, 8));



}
}

mrb
Автор

import java.util.Scanner;

public class Main{
public static void main(String[] args) {

int[] L = {1, 2, 3, 4, 5, 6, 7, 8};

System.out.print("ENTER TARGET: ");
Scanner scan = new Scanner(System.in);
int n = scan.nextInt();

int start = 0;
int end = L.length - 1;

while (start < end){

int mid = (start + end) / 2;

if (L[mid] == n){
System.out.println("Found: " + L[mid]);
break;
} else if (L[mid] < n){
start = mid + 1;
} else if (L[mid] > n){
end = mid - 1;
}
}

if (n < L[start] || n > L[end]){
System.out.println("Not found in array.");
}

scan.close();

}
}

kvelez