Frequently Asked Java Program 20: Searching an Element in Array | Linear Search

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ต.ค. 2019
  • Topics :
    -----------
    1) Searching an Element in Array
    2) Linear Search
    #########################
    Udemy Courses:
    #########################
    Manual Testing+Agile with Jira Tool
    ************************************
    ► lnkd.in/gNqhEq9K
    Selenium with Java+Cucumber
    ********************************
    ► lnkd.in/g5YcAQyR
    Selenium with Python & PyTest
    ********************************
    ► lnkd.in/gvrpyYan
    Selenium with python using Robot framework
    ****************************************
    ► lnkd.in/gxsDf8zR
    API Testing(Postman, RestAssured & SoapUI)
    *****************************************
    ► lnkd.in/gHKQ2v2e
    Web & API Automation using Cypress with Javascript
    ********************************************
    ► lnkd.in/gcZz5Psx
    Playwright with Javascript
    **************************
    ► shorturl.at/gALZ1
    Jmeter-Performance Testing
    ************************
    ► lnkd.in/gA3eiZPY
    SDET Essencials(Full Stack QA)
    *************************
    ► lnkd.in/gmBc4-wD
    Appium-Mobile Automation Testing
    ************************************
    ► lnkd.in/gi_UiRTA
    Java Collections
    *****************
    ► lnkd.in/gZftiiEn
    Python Programming
    *********************
    ► lnkd.in/ghP6WHQz
    Cucumber BDD Framework
    ***************************
    ► bit.ly/3F7d69r
    Protractor with Javascript
    ***************************
    ► lnkd.in/gZnJ2qsS
    ####################################
    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
    ********************
    ► lnkd.in/gfqbR5TC
    GraphQL
    ******************

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

    Cypress Web Testing
    **********************
    ► lnkd.in/gW8SgMna
    Playwright with Javascipt
    **************************
    ► lnkd.in/gQZwaaVD
    #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

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

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

    excellent explanation.need more programs depend on ds programming interview questions

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

    Very well explained 👏
    Thank you so much ❤️

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

    All of your programs that u r explain is excellent

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

    Hello! I recommend using a while loop instead of a for, so you can use flags (Boolean, i.g. while(!found && i

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

      i am taking input from user and not adding break and still it works fine

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

    Thank you. Excellent teaching skills

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

      You are welcome!

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

    Excellent. more useful for me. i shared with my frined s and collegues also. please do more concepts on searching and sorting techniques

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

    Thank you so much for your help!

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

    Thank You so much Sir.

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

      You are most welcome

  • @virusehwag9562
    @virusehwag9562 4 ปีที่แล้ว +4

    Bro excellent teaching skills please do more videos on programs & on concepts too

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

      Sure.I will do, Please share my videos to your friends and colleagues.

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

    Can i use else statement after founding the element and print the statement

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

    Instead of Boolean can We use else Condition?

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

    Thank you sooo muchhh

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

    thanks

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

    Is there any problem if I take boolean flag as True at starting

  • @sihi__
    @sihi__ ปีที่แล้ว +4

    Can we write else part inside for loop ?

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

      you can use else. But in this code, it will do the else block for every iteration that it is not equal to the element.

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

    Sir,As we have break the loop why the statement System.out.println("Element not found")work outside the for loop?

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

      Break statement is inside a loop...so the loop will break upto it...

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

    superb sir... i have a doubt if the array is to be got from the user...... it should be in a for loop... how should be the scanner should be.... pls explain

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

      Scanner sc=new Scanner(System.in);
      n=sc.nextInt();
      int a[]=new int[n];
      for(int i=0;i

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

      @@renjithu8078 thank u

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

    thanks!!

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

    Sir can we write "break" also in else part ?

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

      No need it will automatcaly break

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

    Does break; statement needed here?

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

      if you not break the loop when the element is found, the loop still runs, the adv is it saves space, if not break, if the input is {10,20,30,50,50} it gives two times the search element is found at 3,4

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

    sir what if there are two 20 value in an array???

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

    Commenting for better reach

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

    If I do this program with enhanced for loop then what to write if I want to print index position
    public class Code{
    public static void main(String[] args){
    int a[]= {10,20,40,50,30};
    int srch_ele=30;
    boolean flag=false;
    for(int i:a){
    if(srch_ele==i){
    System.out.println("Element found" + ); //for index position
    flag=true;
    break;
    }
    }
    if (flag==false){
    System.out.println("Element not found");
    }
    }
    }

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

      in enhanced loop you cant access the index position