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

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2019
  • Topics :
    ----------
    1) Searching an Element in Array
    2) Binary Search
    #########################
    Udemy Courses:
    #########################
    Manual Testing+Agile with Jira Tool
    ************************************
    ► shorturl.at/xNXZ4
    Selenium with Java+Cucumber
    ********************************
    ► shorturl.at/aIKMW
    Selenium with Python & PyTest
    ********************************
    ► shorturl.at/ELW09
    Selenium with python using Robot framework
    ****************************************
    ► shorturl.at/bcDPZ
    API Testing(Postman, RestAssured & SoapUI)
    *****************************************
    ► shorturl.at/uAWY7
    Web & API Automation using Cypress with Javascript
    ********************************************
    ► rb.gy/4uum2n
    Playwright with Javascript
    **************************
    ► shorturl.at/gALZ1
    Jmeter-Performance Testing
    ************************
    ► rb.gy/ocj7r2
    SDET Essencials(Full Stack QA)
    *************************
    ► rb.gy/hlnf2v
    Appium-Mobile Automation Testing
    ************************************
    ► rb.gy/wmzv64
    Java Collections
    *****************
    ► bit.ly/3S66ezE
    Python Programming
    *********************
    ► urlis.net/gdsfpb0s
    Cucumber BDD Framework
    ***************************
    ► bit.ly/3F7d69r
    Protractor with Javascript
    ***************************
    ► urlis.net/4uddm1qb
    ####################################
    TH-cam Playlists:
    ####################################
    Manual Testing & Agile
    ***********************
    ► bit.ly/3ujvaYa
    ► bit.ly/3OYzxQj
    SQL
    *************************
    ► bit.ly/3R6XjeG
    ► bit.ly/3nE0a1s
    ► bit.ly/3IeKuuJ
    linux & Shell Scripting
    **********************
    ► bit.ly/3up1Z6a
    ► bit.ly/3nzvGxx
    Java
    **********************
    ► bit.ly/3R9QfOs
    ► bit.ly/3AoRMKM
    ► bit.ly/3IbTTDn
    ► bit.ly/3ybXInv
    ► bit.ly/3yCoHdw
    Selenium With Java+Cucumber
    ********************************
    ► bit.ly/3P2FMm4
    ► bit.ly/3yhiIt4
    ► bit.ly/3uokzet
    ► bit.ly/3a7XIND
    ► bit.ly/3umN2S9
    ► bit.ly/3aar7GW
    ► bit.ly/3y9kD2S
    ► bit.ly/3uhLskn
    Python
    ********************************
    ► bit.ly/3agNgU0
    ► bit.ly/3NJNnoy
    ► bit.ly/2CTQ4mR
    ► bit.ly/3OIYWh1
    Selenium With Python,Pytest&Behave
    ***************************************
    ► bit.ly/3OHHoC9
    ► bit.ly/3IeNLdv
    ► bit.ly/2J4tPeT
    ► bit.ly/3ydSkAq
    Selenium With Python Using Robert Framework
    (Web&API Testing)
    *************************************************
    ► bit.ly/3nUvlpr
    ► bit.ly/3nUvE3z
    API Testing (Postman,SoapUi,&Rest Assured)
    **********************************************
    ► bit.ly/3OXacWY
    ► bit.ly/3yh0UhE
    ► bit.ly/3nC9DWQ
    ► bit.ly/3yGfhNS
    ► bit.ly/3OJa11H
    ► bit.ly/3P2slCC
    Mobile App Testing Appium
    ****************************
    ► bit.ly/3Al49HG
    Performance Testing Jmeter
    *******************************
    ► bit.ly/3nz4fE7
    Maven,Jenkins,Git,Github,CI/CD
    *******************************
    ► bit.ly/3P16HPj
    ► bit.ly/3yhlUVA
    ► bit.ly/3afYfwT
    ► bit.ly/3yGzweG
    ► bit.ly/3yF73Ws
    ► bit.ly/3NCOmH7
    SQL,DB Testing&ETL,Bigdata
    *******************************
    ► bit.ly/3NKOcNY
    ► bit.ly/3OVpDyI
    ► bit.ly/3NEvUy0
    ► bit.ly/3IryxlT
    ► bit.ly/3RkWBLh
    JavaScript Based Automation Tools
    ********************************
    ► bit.ly/3nUx51X
    ► bit.ly/3AqI6Q0
    ► bit.ly/3yeurbT
    ► bit.ly/3ujzpTK
    Selector Hub Tools
    ********************
    ►rb.gy/h3h424
    GraphQL
    ******************
    ► rb.gy/sj3gys
    Cypress API Testing
    ********************
    ► shorturl.at/fjKPX
    Cypress Web Testing
    **********************
    ► shorturl.at/agjlK
    Playwright with Javascipt
    **************************
    ► shorturl.at/adSTY
    #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

ความคิดเห็น • 48

  • @rajeshbe2234
    @rajeshbe2234 14 ชั่วโมงที่ผ่านมา

    Thank you for this video sir. One request, Please remove the background noise which is making irritating while watching the video.
    That irritating sound is coming in all your java interview Q&A series. So please consider my request.

  • @syedajaveriyaafreen
    @syedajaveriyaafreen 3 ปีที่แล้ว +5

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

  • @rachanabr
    @rachanabr ปีที่แล้ว +6

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

  • @sai11peravarapu70
    @sai11peravarapu70 2 ปีที่แล้ว +1

    How we can do the same binary search with for loop i tried for( low=0;low

  • @ManishTronics
    @ManishTronics 2 หลายเดือนก่อน

    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.

  • @shakulhameed1767
    @shakulhameed1767 2 ปีที่แล้ว

    is it only working sequential order in array?

  • @dasareddyudayasandhya9046
    @dasareddyudayasandhya9046 หลายเดือนก่อน +1

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

    • @sdetpavan
      @sdetpavan  หลายเดือนก่อน

      Glad it was helpful!

    • @JAVA_TECH160
      @JAVA_TECH160 19 วันที่ผ่านมา

      automation tester what types of coding will ask for expeirence candiadtes can make playlist

  • @huayang2467
    @huayang2467 ปีที่แล้ว +3

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

    • @sdetpavan
      @sdetpavan  ปีที่แล้ว

      You are very welcome

  • @danielhoffman4026
    @danielhoffman4026 3 ปีที่แล้ว

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

  • @mahendranprofessional213
    @mahendranprofessional213 9 หลายเดือนก่อน +2

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

    • @sdetpavan
      @sdetpavan  9 หลายเดือนก่อน

      Glad to hear that

    • @sravsd1123
      @sravsd1123 4 หลายเดือนก่อน

      Yes sir.. I am also feeling the same

  • @yogeshjadhavybj5773
    @yogeshjadhavybj5773 ปีที่แล้ว +1

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

  • @amnaameir4413
    @amnaameir4413 3 ปีที่แล้ว +1

    I understood it clearly..thanks!

  • @danielhoffman4026
    @danielhoffman4026 3 ปีที่แล้ว

    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.

  • @apgamer9096
    @apgamer9096 ปีที่แล้ว

    It is very helpful for class 10 icse

  • @ankithkamath4735
    @ankithkamath4735 2 ปีที่แล้ว +2

    Wonderfull explanation, thanks

  • @glenndelostrico7301
    @glenndelostrico7301 ปีที่แล้ว

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

  • @ilavarasansriraman4140
    @ilavarasansriraman4140 3 ปีที่แล้ว +2

    Thanks for this wonderful tutorial

    • @sdetpavan
      @sdetpavan  3 ปีที่แล้ว

      You're welcome 😊

    • @ilavarasansriraman4140
      @ilavarasansriraman4140 3 ปีที่แล้ว

      @@sdetpavan Sir could you pls create tutorial on Extent Report 5

  • @veereshchinna9934
    @veereshchinna9934 3 ปีที่แล้ว +2

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

  • @venkatasubbareddy6179
    @venkatasubbareddy6179 3 ปีที่แล้ว +1

    Very good explanation sir

  • @swayamprakashbhuyan2580
    @swayamprakashbhuyan2580 2 ปีที่แล้ว +1

    Commenting for better reach

  • @mrb7931
    @mrb7931 ปีที่แล้ว

    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));
    }
    }

  • @vishnuswaroop6876
    @vishnuswaroop6876 3 ปีที่แล้ว

    Using the binary search logic - how can we identify the exact position instead of element found ?
    Can let us know sir

    • @TechStack9
      @TechStack9 3 ปีที่แล้ว +1

      m is the position of the element. You can print it as System.out.println("Element Found at position:" + (m+1));

    • @vishnuswaroop6876
      @vishnuswaroop6876 3 ปีที่แล้ว +1

      Thanks sir

    • @shivamsatpathy5171
      @shivamsatpathy5171 2 ปีที่แล้ว

      @@TechStack9 plss reply what if there is no element given then how will I initialise the array plss explain

    • @navneetsingh9947
      @navneetsingh9947 ปีที่แล้ว

      ​@@shivamsatpathy5171 using scanner class

  • @sivajikottisa8990
    @sivajikottisa8990 ปีที่แล้ว

    Sir why using Boolean= false can explain

    • @nikhil6279
      @nikhil6279 ปีที่แล้ว

      to initialize boolean and its default value is false

  • @Mm-zt1gk
    @Mm-zt1gk 4 ปีที่แล้ว +1

    What if differences between alternate elements are not same

    • @TechStack9
      @TechStack9 3 ปีที่แล้ว

      It doesn't matter

  • @erix_1
    @erix_1 3 ปีที่แล้ว

    apaga saporra ae

  • @kvelez
    @kvelez 10 หลายเดือนก่อน

    package javaapplication23;
    public class JavaApplication23 {
    public static void main(String[] args) {

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

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

    while (start target) {
    end = mid - 1;
    }
    }

    if (start > end){
    System.out.println("Item not found");
    } else {
    System.out.println("Item not found.");
    }

    }

    }

  • @ilavarasansriraman4140
    @ilavarasansriraman4140 3 ปีที่แล้ว +2

    @1: 46 -> you are telling left side . => but its right side..

    • @shahbajshaikh9196
      @shahbajshaikh9196 2 ปีที่แล้ว

      Yes i am aslo getting confuged there....

    • @taestedkookies6620
      @taestedkookies6620 24 วันที่ผ่านมา +1

      It's left side from array and right side from us

  • @kvelez
    @kvelez 10 หลายเดือนก่อน

    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();
    }
    }

  • @go_fool
    @go_fool 9 หลายเดือนก่อน

    It's zero not jero