How to Print in Lexicographical Order using Recursion?? | Algorithms

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ก.ย. 2024
  • Please consume this content on nados.pepcoding.com for a richer experience. It is necessary to solve the questions while watching videos, nados.pepcoding.com enables that.
    NADOS also enables doubt support, career opportunities and contests besides free of charge content for learning. In this video, we explain about Lexicographical order or the order in which words are present in the dictionary. With this, we present the problem where we are required to print numbers in a lexicographical manner and discuss the solution using Recursion and Euler Tree.
    .....................................................................................................................................................................
    Pepcoding has taken the initiative to provide counselling and learning resources to all curious, skilful and dedicated Indian coders. This video is part of the series to impart industry-level web development and programming skills in the community.
    For better experience and well organised free resources visit -
    We also provide professional courses with live classes and placement opportunities.
    DSA Level 1 and Level 2
    www.youtube.co...
    Webinar on GATE Preparation
    • Video
    Here is a roadmap to our Free study content and know more about our resources here - www.pepcoding....
    We are also available on the following social media platforms: -
    Facebook(Meta) - / pepcoding
    Instagram - / pepcoding
    LinkedIn - / pepc. .
    Pinterest - / _c. .
    Twitter - / pepcoding
    TH-cam (English Channel)- / @pepcodingprogrammingi...
    Also take a look at our placement assistance - www.pepcoding....
    HAPPY PROGRAMMING!
    Pep it up.....
    Hashtags
    #pepcoding #recursion #lexicographicalorder

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

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

    This is the exact code I came up with after seeing the question part of the video, Although it took me an hour, Thank you so much sir.. aapke series ko foundation se follow krta aarha hu.. ab dimag ki taarein judne lagi h..😂 sab aapke wajah se hi possible ho paaya h.. ab toh shukriya bhi chhota word lgta h aapko bolne ke liye.. you're damn awesome teacher..

  • @PratyushKumar-cx4jz
    @PratyushKumar-cx4jz หลายเดือนก่อน +1

    The man who teach too good

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

    Recursive leap of faith is very important in problem solving!

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

    No one can beat you sir.Huge respect for you for providing these content.

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

    Your explanations are always best!

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

    Gajab level up questions are really intuitive

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

    If u still want to improve run time of the solution check wether it(10*i+j) exceeds n inside for loop itself :

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

    literally, i saw this video in normal speed because of your explanation
    it's super

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

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

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

    Sir can u make a video on how to remain motivated on on-campus tests after getting rejections in some starting companies :)

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Yes, will do one soon

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

    Sir logic shi socha tha ekdum bas code ke syntax bas dekhna pda thoda sa nhi to sara khud se ben gya best qustion form level1 to levelup so sir mja aa gya bole to

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

      Koi dikkat nh beta, keep it up!

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

    maza aaya..seekhne main.. :) Thank you bhaiya

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

    Sir ji, plz include the time and space complexity too. Its always asked in interviews. Thanks

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

    This concept is something we will never forget :), whats the time and space complexity ?

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

      O (n). Har number ek baar he visit hua hai

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

      space complexity should be O(L) where L is number of digits in the number

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

      @@Pepcoding pr stack frame jo bana hai uska space nahi count hoga kya ??

  • @SAMARTHSINGH-lv2wp
    @SAMARTHSINGH-lv2wp 3 ปีที่แล้ว +1

    Sir if possible please do discuss time complexity too.Please

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

    very interesting problem

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

    Can someone explain how time complexity of this is O(n)..

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

    sir for "n = 13" it gives wrong output!

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

    Sir bhot acha kaam kr rhe ho

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

    really good stuff

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

      Glad you think so!

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

    great explanation!

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

    Wow!
    You should write a book on DSA

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

      Thankyou beta!
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

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

    awesome sir

  • @SaiKiran-gn8fg
    @SaiKiran-gn8fg ปีที่แล้ว

    Tq

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

    thank sir no one clearly explained what is lexicograpghical order

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

    The initial 4 minutes only made the solution clear ..... awesome

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

      Thankyou beta!
      I am glad you liked it. I hope that you are watching till the end and trying to understand what, how, and especially why of the problem.
      If you like our efforts, will you like to write a few words about us here (www.quora.com/What-are-the-good-websites-to-learn-data-structures-and-algorithms )

  • @AniketYadav-nu3fb
    @AniketYadav-nu3fb 2 ปีที่แล้ว

    Mast tha ❤️

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

      Glad you love the explanation, For better experience and well organised content sign up on nados.io and start learning.

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

    till 04:10, i got the approach and was able to code it up myself later

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

      Great!
      Keep going.
      And for better experience, visit nados.io, where you will get well curated content and career opportunities.

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

    How to print String in lexicographical Order?

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

    Such a clear explanation.... Many thanks to you :)

  • @AnandKumar-kz3ls
    @AnandKumar-kz3ls 2 ปีที่แล้ว

    class Solution {
    public:
    vector res;
    void dfs(int num,int n){
    if(num>n) return;
    for(int i=0;i

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

      For better experience and well curated content sign up on nados.io and keep learning.

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

    sir is this a part of levelup ?

  • @satyamsharma8718
    @satyamsharma8718 4 ปีที่แล้ว

    Hello sir..
    Sir mujhe bas C language ata hai
    Or java bilkul nahi ata hai..
    To sir java foundation course Karu
    Ya fir pahele java basic kahi or resource se learn karu and then apka java foundation course and then levelup karu..
    Please sir guide me

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

      beta pehle 5 lectures yahan se karlo, java aa jaegi.
      www.pepcoding.com/resources/online-java-foundation
      2 din lagenge sirf

    • @satyamsharma8718
      @satyamsharma8718 4 ปีที่แล้ว

      @@Pepcoding thank you sir 😊

    • @anjneykumarsingh4461
      @anjneykumarsingh4461 4 ปีที่แล้ว

      Bhai mai bhi c k through ds krra tha ab chod di sir n jaise ds through java pdhai h you will fall in love , recursion❤

    • @satyamsharma8718
      @satyamsharma8718 4 ปีที่แล้ว

      @@anjneykumarsingh4461 thanks dude.. 👍

  • @ayushgoel9584
    @ayushgoel9584 4 ปีที่แล้ว

    Sir please iske sath parallely Arrays and String start kar dijiye, uske tricky questions mein dikkat aa rhi hai

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

      beta, bhot stress ho rha hai. bache calls jyada kar rhe hain. Uthani bhi jaroori hai. Uski wajah se mai target miss kar rha hun. Agar time mile to 5 iski, 5 uski bna doon

    • @anshgoel1220
      @anshgoel1220 4 ปีที่แล้ว

      @@Pepcoding Sir specified time pr lia kro na calls vrna overtime wear out hojaoge fr lagega galat mussebat galle pdgyi , fr pta chle nahi video bana ne ka mann kre, nahi calls lene ka :-)

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

    This question seems like from levelup.

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

    sir to phir 002 100 se pehle aana chahiye na

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

      Hope you like the explanation.
      Visit - nados.pepcoding.com and sign up to NADOS.
      Also you can ask your doubts on community tab. There are lots of programmers and mentors who can help you out with such doubts.
      Don't forget to follow us on Instagram instagram.com/pepcoding/

  • @ishaankapoor1884
    @ishaankapoor1884 4 ปีที่แล้ว

    What is dfs?

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Depth first search. Level1 ke graphs kijie pehle.

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

    one thing i unserstand is faith is very important hahahah

  • @AmandeepSingh-ot6st
    @AmandeepSingh-ot6st 4 ปีที่แล้ว

    Time complexity = O(n) ?
    Coz each number is traversed once🙄🙄

  • @jabedhasan21
    @jabedhasan21 6 วันที่ผ่านมา

    I am still watching and learning from this channel.
    But you guys stop creating content on the channel.🥲

  • @indiansoftwareengineer4899
    @indiansoftwareengineer4899 4 ปีที่แล้ว

    New thumbnail on Video...
    Nice channel to follow...

    • @Pepcoding
      @Pepcoding  4 ปีที่แล้ว

      Thanks and welcome

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

    public static void helper(int curr,int n){
    if(curr>n){
    return;
    }
    System.out.println(curr);
    helper(curr*10,n);
    if(curr%10+1