Recursion Questions - 4 | GCD | Euclids Algorithm | Lecture 31 | Java & DSA Course

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 70

  • @CollegeWallahbyPW
    @CollegeWallahbyPW  Год назад +3

    PW Skills is announcing the launch of the following programs,
    Binary Batch:- Java-with-DSA-&-System-Design (Java with DSA & System Design)
    pwskills.com/course/Java-with-DSA-and-system-design (Hindi)
    pwskills.com/course/Java-with-DSA-and-System-Design (English)
    Sigma Batch:- Full-Stack-Web-Development (MERN Stack)
    pwskills.com/course/Full-Stack-web-development (Hindi)
    pwskills.com/course/Full-Stack-Web-Development (English)
    Impact Batch:- Data-Science-Masters (Full Stack Data Science)
    pwskills.com/course/Data-Science-masters (Hindi)
    pwskills.com/course/Data-Science-Masters (English)

  • @johnsonsvaselly5008
    @johnsonsvaselly5008 Год назад +16

    Maam plz upload video regularly .I know ur were busy .. And tq for this lecture.

  • @mathlover7688
    @mathlover7688 Год назад

    aisa teacher kabhi nhi dekha yaar most compicated topics ko v hum jaise bache ko ye feel kara di ki ye sab toh bacho ka khel h ,hats of mam

  • @AbhayGupta-oz1ix
    @AbhayGupta-oz1ix 5 месяцев назад

    Thanks To Mam for incredible explanation.
    1) gcd(x,y) = gcd(y,x%y) recursive relation
    2) gcd(x,o) = x base case
    3) lcm(x,y) = x*y / (gcd(x,y))

  • @yashmoriya6891
    @yashmoriya6891 Год назад +1

    Its to much clear and helping class. 😊😍

  • @chiranjivipatnaik8424
    @chiranjivipatnaik8424 Год назад

    Thank you mam for your consistency please complete this course as per syllabus in time🙏🙏🙏

  • @ayushgupta4803
    @ayushgupta4803 8 месяцев назад

    best course ever

  • @gaurisagar8486
    @gaurisagar8486 4 месяца назад

    Thank you ma'am ☺️

  • @akhandpratapsingh1559
    @akhandpratapsingh1559 Год назад +6

    Please maintain consistency in uploading the lectures

    • @Dipzeus
      @Dipzeus Год назад +2

      brother she is an engineer in Google she also has work .. if you r interested in fast learning you can follow saurav shukla sir lectures or telusko

    • @yuvrajthakur143thakur3
      @yuvrajthakur143thakur3 2 месяца назад

      Bro do you have notes of this course

  • @sanjupaul276
    @sanjupaul276 Год назад +2

    Mam please upload lectures
    daily.

  • @kartikpaul3161
    @kartikpaul3161 Год назад +3

    Please upload, routine wise video 🙏

  • @bravoboom3246
    @bravoboom3246 Год назад +6

    I solved GCD's all approaches and also solved LCM
    public class R9_GCD {
    //Brute force approach
    static int BruteGCD(int x, int y){
    //finding the greatest common divisor
    int min = Math.min(x,y);
    int max = 0;
    for(int i = min ; i >= 1; i--){
    if(x % i == 0 && y % i == 0 && max < i){
    max = i;
    }
    }
    return max;
    }
    //Iterative way
    static int iterativeGGD(int x, int y){
    //it doesn't matter which num is great if y > x then x % y = 0, it changes the value to y = x
    while (x % y != 0){
    int rem = x % y;
    x = y;
    y = rem;
    }
    return y;
    }
    //Euclid's Algorithm
    static int EuclidGCD(int x, int y){
    if(y == 0) return x;
    return EuclidGCD(y,x%y);
    }
    //LCM
    static int LCM(int x, int y){
    //formula is [ LCM * GCD = X * Y or LCM = (X * Y) / GCD ]
    return (x * y) / EuclidGCD(x,y);
    }
    public static void main(String[] args) {
    int x = 12, y = 16;
    System.out.println("By Brute force approach : " + BruteGCD(x,y));
    System.out.println("By Iterative way : " + iterativeGGD(x,y));
    System.out.println("By Euclid's algorithm : " + EuclidGCD(x,y));
    System.out.println("LCM is : " + LCM(x,y));
    }
    }
    Output :
    By Brute force approach : 4
    By Iterative way : 4
    By Euclid's algorithm : 4
    LCM is : 48

  • @RiantDadra
    @RiantDadra Год назад +1

    ❤‍🔥❤‍🔥thankyou maam

  • @piyushmishra860
    @piyushmishra860 Год назад +3

    Check this number is armstrong or not using recursion..
    import java.util.Scanner;
    class Recurrision{
    static int armstrong(int n){
    if(n >=0 && n

    • @MehakSrivastava-f9v
      @MehakSrivastava-f9v 5 месяцев назад

      this code run for only three digit number.What about four digit number?

  • @alokraj0575
    @alokraj0575 Год назад +2

    mam please upload regularly video just like previous year

  • @Luffy_2804
    @Luffy_2804 Год назад +1

    grinding everyday

  • @sumittiwari231
    @sumittiwari231 Год назад +1

    sorry for late but finally lec 31 is completed. mam mera college exam aa rha hai jiske karan meri consistency thoda kharab ho rhi hai . lekin mam mai puri kosis karunga ki mai consistent rhu. jb yudh me entry le he leya hai to yudh ko jeet ke bhi niklange. mam you are really awesome

  • @umanandan36
    @umanandan36 Месяц назад

    static int GreatesstCommon(int x,int y){
    int a=Math.min(x, y);
    do {
    a--;
    }while (x%a!=0 || y%a!=0);
    return a;
    }
    brute force approach

  • @Luffy_2804
    @Luffy_2804 Год назад

    Long Divison Approach To Find Gcd (optimised one) :
    static int bruteForceGcd3 (int num1 , int num2){
    // long division approach
    // necessary condition num2 < num1
    if(num1==0 && num2!=0) return num2;
    else if(num2==0 && num1!=0) return num1;
    else if(num1==0 && num2==0) return 0;
    if(num2

  • @UdayGarg
    @UdayGarg 11 месяцев назад +1

    Assignment not available in website

  • @anushkatupe9502
    @anushkatupe9502 4 месяца назад

  • @shubhamdewangan8129
    @shubhamdewangan8129 Год назад +1

    Hello mam
    Mam apke lecture me kadance algorithm upload kab kar rahe hain ?

  • @owjiya
    @owjiya Год назад +1

    When digital marketing course will start plz tell me

  • @Luffy_2804
    @Luffy_2804 Год назад

    Brute Force Approach Mam Wants Us To Do :(
    static int bruteForceGcd2(int num1 , int num2){
    // some necessary conditions when we do not have to do iterations over the numbers
    if(num1==0 && num2!=0) return num2;
    else if(num2==0 && num1!=0) return num1;
    else if(num1==0 && num2==0) return 0;
    // using min number for iteration
    int minNum = 0;
    // using ans variable to store the gcd of the two numbers
    int ans = 0;
    // finding min number using if-else
    if(num10; i--){
    if(num1%i==0 && num2%i==0){
    ans = i;
    break;
    }
    }

    return ans;
    }

  • @Adarsh_Thakur365
    @Adarsh_Thakur365 Год назад +2

    How to I download notes & pdfs.....?

  • @ajeykumar02
    @ajeykumar02 Год назад +1

    how can i download notes from 29th class to today till

  • @svedits7567
    @svedits7567 Год назад

    Marking my attendance
    Mam can you please try to upload more lectures thank you

  • @Timepassgaming04
    @Timepassgaming04 Год назад +1

    Try to upload daily.

  • @Timepassgaming04
    @Timepassgaming04 Год назад +1

    Leetcode series bhi ni aa rhe.

  • @sagarchawla4892
    @sagarchawla4892 2 месяца назад

    Can't access notes and assignments

  • @janmejaysahu9011
    @janmejaysahu9011 Год назад +1

    Mam very soon we meet in binary Hindi batch

    • @Sehore_Defence_Academy
      @Sehore_Defence_Academy Год назад +1

      binary java course me DSA problem solving lecture ayenge kya schedule me nhi diye

    • @notaproblem7770
      @notaproblem7770 Год назад

      PW ke helpline no pe puch le bhai

    • @janmejaysahu9011
      @janmejaysahu9011 Год назад

      @@Sehore_Defence_Academy beginner se lekar ke advance tok chale ga bas aap ko motivate or dedication dikhana hai hai bas utne mai Kam ban jaye ga

    • @janmejaysahu9011
      @janmejaysahu9011 Год назад

      @@notaproblem7770 am already purchased bro

  • @vcIND18
    @vcIND18 Год назад

    ✅✅

  • @i_foodie00
    @i_foodie00 Год назад +1

    Day 2 of recursion prac 23 sept

  • @kartik_verma_452
    @kartik_verma_452 Год назад +2

    How to become a white hat hacker please tell

  • @innocentguys6306
    @innocentguys6306 Год назад

    Mam thumbnail fibbonaccci ka laga rkha hai

  • @Luffy_2804
    @Luffy_2804 Год назад

    day 6 of maintaining consistency :(

  • @srijitswain7649
    @srijitswain7649 Год назад +2

    How to write ≠

  • @ashishsen1199
    @ashishsen1199 Год назад +1

    Ma'am DSA ka course poora hoga ya nhi

    • @indianengineer5802
      @indianengineer5802 Год назад

      Bhai ense mat pado learning pace bhaut slow ho jaega..... Find some other substitute on RUclips or go for some paid course.

    • @janmejaysahu9011
      @janmejaysahu9011 Год назад

      @@indianengineer5802 nehi tuma programmer ban na chahate ho to long time and slowly sedule follow kara agar aap coder banna chahete ho to short term time lelo

    • @indianengineer5802
      @indianengineer5802 Год назад +1

      @@janmejaysahu9011 aapne toh meri aankhen khol dii 🐻

    • @janmejaysahu9011
      @janmejaysahu9011 Год назад

      @@indianengineer5802 😂😂😂

  • @Luffy_2804
    @Luffy_2804 Год назад

    anybody got the time complexity of euclids gcd :(

  • @muzammilhussain7255
    @muzammilhussain7255 Год назад

    this method is not work well to find LCM plz guide
    // method 1 iterative approach issue with this approach
    //formula is [ LCM * GCD = X * Y or LCM = (X * Y) / GCD ]
    static int iGCD(int x, int y){
    while (x%y!=0){
    int rem=x%y;
    x=y;
    y=rem;
    }
    return y;
    }
    static int iLCM(int x, int y){
    return (x*y)/y;
    }
    public static void main(String[] args) {
    Scanner sc=new Scanner((System.in));
    System.out.println("enter 1st number");
    int a= sc.nextInt();
    System.out.println("enter 2nd number");
    int b= sc.nextInt();
    System.out.println("result of method 1");
    System.out.println(iLCM(a,b));
    //output
    enter 1st number
    50
    enter 2nd number
    20
    result of method 1
    50

    • @monugit9
      @monugit9 11 месяцев назад

      store y(gcd ans) at different variable

  • @Adarsh_Thakur365
    @Adarsh_Thakur365 Год назад +1

    Pw skill website is not working....
    Help....

  • @indianengineer5802
    @indianengineer5802 Год назад +4

    Dimag kharab hai kya.... Etna lamba kra rhe course faltu mein.... Please don't upload if you want to waste the time of begginers

    • @indianengineer5802
      @indianengineer5802 Год назад

      @shivamkrgupta3230 bro it's been 2.5 months she started DSA, and solving recursion problems 🙂. Looks like you're learning it for first time. Stack queue tak toh 6 mahine le lengi ye 🙂

    • @indianengineer5802
      @indianengineer5802 Год назад

      @shivamkrgupta3230 let's see, we all are here 🙂

    • @indianengineer5802
      @indianengineer5802 Год назад

      @shivamkrgupta3230 mujhe aata hai bhai I am placed 🙂

    • @indianengineer5802
      @indianengineer5802 Год назад

      @shivamkrgupta3230 Deutsche Bank

    • @indianengineer5802
      @indianengineer5802 Год назад

      @shivamkrgupta3230 maine python se kiya hai