Inorder Tree Traversal without Recursion | GeeksforGeeks

Sdílet
Vložit
  • čas přidán 11. 09. 2024

Komentáře • 39

  • @shivankchopra7429
    @shivankchopra7429 Před 6 lety +22

    Amazing teacher with clarity and zero non sense! I regret not having found your channel before!

  • @oneworldofstem7724
    @oneworldofstem7724 Před 3 lety +14

    Amazing teacher!! Btw, I wonder how do you come up with these 5 steps in 2:39? I think the thinking process is what I REALLY need to learn. Thanks in advance.

  • @wongisa368
    @wongisa368 Před 4 lety +5

    very good video and it did solve my problem, thanks!

  • @madagalaharivardhan9412
    @madagalaharivardhan9412 Před 5 lety +1

    EXCELLENT and NICE ATTRACTIVE WAY OF TEACHING

  • @huda9126
    @huda9126 Před 5 lety +1

    Can you help me please to found answer for this qustion ☺️
    Write a C++ program to iteratively (not recursively) insert an element in a binary tree.
    Required operations:
    a. Insert number of elements in a binary tree. Before inserting each element, make sure that it is not exist in the tree.
    b. Display an error message if we try to insert an element that is already exist in the tree.
    c. Print the inorder traversal of the tree.

  • @JamesBrodski
    @JamesBrodski Před 3 lety

    Thank you so much for this amazing video.

  • @poorvisaxena7055
    @poorvisaxena7055 Před 3 lety +1

    I want to know if this playlist on trees is enough for coding interviews; along with practise of questions, of course.

  • @krishankantray
    @krishankantray Před 7 lety +3

    Excellent explanation......and nice voice......Thumbs up.....keep it up....

  • @saisrikar7987
    @saisrikar7987 Před 6 lety +1

    excellent explanation ..Thanks

  • @kautukraj
    @kautukraj Před 4 lety +1

    Very helpful!

  • @ven7782
    @ven7782 Před 7 lety +1

    Thanks for the amazing video.

  • @Cdswjp
    @Cdswjp Před 4 lety +3

    Thank you. Is this faster than recursive approach?

    • @michaelqu6732
      @michaelqu6732 Před 2 lety

      No. Traversal has to go through every node so both of them are bounded by O(n)

  • @satyeshtripathi8533
    @satyeshtripathi8533 Před 4 lety +1

    is the worst-case space complexity of this approach O(d) where d is the depth of the tree?

  • @nibedita__dey
    @nibedita__dey Před 3 lety

    Thank u sir it's very helpful !

  • @matanyaasis2
    @matanyaasis2 Před 7 lety

    memory is O(h) right?

  • @jamest7700
    @jamest7700 Před 4 lety

    what is the space complexity?

  • @khaledsabri6429
    @khaledsabri6429 Před 5 lety

    amazing, thank you so much.

  • @rubencristobalgarcia185
    @rubencristobalgarcia185 Před 7 lety +3

    Great videoo thanksss

  • @jethalalnhk2409
    @jethalalnhk2409 Před 4 lety

    Very good

  • @mddar95
    @mddar95 Před 6 lety +1

    Thanks alot man !

  • @ruchakhartadkar773
    @ruchakhartadkar773 Před 5 lety

    helpful!
    thankyou!

  • @arianphilips5777
    @arianphilips5777 Před 5 lety

    excellent

  • @jayshah8271
    @jayshah8271 Před 7 lety +1

    when you will upload next video to related all question on tree?

    • @GeeksforGeeksVideos
      @GeeksforGeeksVideos  Před 7 lety

      Hi Jay,
      We are working on it. And, you should see more video tutorials on Tree topics in the coming weeks.

  • @moazelsawaf2000
    @moazelsawaf2000 Před 4 lety

    Thanks

  • @VenkateshNair
    @VenkateshNair Před 7 lety +1

    thnks man

  • @bindujesin5511
    @bindujesin5511 Před 4 lety

    Good😍

  • @malharjajoo7393
    @malharjajoo7393 Před 7 lety +2

    Much easier logic - Just loop over stack until it is empty.
    // Example program
    #include
    #include
    #include
    using namespace std;
    class BinaryTree
    {
    public:
    BinaryTree(int val, BinaryTree* left,BinaryTree* right):val(val),left(left),right(right){}
    int val;
    BinaryTree* left;
    BinaryTree* right;
    };
    void pushToStack(stack& s1, BinaryTree* root)
    {
    while(root != NULL )
    {
    s1.push(root);
    root = root->left;
    }
    }
    void stackTraversal(stack s1,BinaryTree* root)
    {
    BinaryTree* current = root ;
    pushToStack(s1,root);
    while(!s1.empty())
    {
    cout

  • @pg7703
    @pg7703 Před 6 lety +2

    any body please share the c++ code.

    • @tienanzhang6317
      @tienanzhang6317 Před 6 lety +1

      www.geeksforgeeks.org/inorder-tree-traversal-without-recursion/

  • @soumengorain2891
    @soumengorain2891 Před 6 lety

    Tomorrow's ma xams😂😂