Build Balanced BST from Sorted Array | C++ Placement Course | Lecture 28.5

Поділитися
Вставка
  • Опубліковано 17 жов 2024

КОМЕНТАРІ • 51

  • @The_Empire_Vstech
    @The_Empire_Vstech 3 роки тому +3

    Error is - expected initializer before. '* ' tolen
    This was found in
    node * buildbst(int arr[],int start,int end)
    {}

  • @khokonchandra218
    @khokonchandra218 7 місяців тому +1

    Awesome explanation

  • @satender5389
    @satender5389 3 роки тому +4

    Where do we get our queries or doubt solved?
    Especially came from this video?

  • @hustlewithVaibhav
    @hustlewithVaibhav 3 роки тому +5

    Thank you 🙏🙏

  • @chirag_me
    @chirag_me 3 роки тому +8

    bhaiya Nimcet exam preperation kai lie bhi video bana do.... koi bhi content provider nhi hai..... aap hi hit ho jaoge....

    • @PIYUSH-lz1zq
      @PIYUSH-lz1zq 2 роки тому

      Bro , nimcet clear hogaya ?? Agar Huya/nahi to konsa clg liya ?? Same category se hai

    • @chirag_me
      @chirag_me 2 роки тому

      @@PIYUSH-lz1zq bhai abhi 1st sem mein hu... bechlor degree kai

    • @TheDailyProphet789
      @TheDailyProphet789 Рік тому

      @@chirag_me mujhe v krni hai pr avi tk smjh ni aayekha senkru

  • @princijaiswal2461
    @princijaiswal2461 3 роки тому +1

    ye question leetcode pe thora change h because sort array to bst wle function mein sirf do hi argument pass h ek *nums aur dusra numsSize

    • @vimalslab3398
      @vimalslab3398 3 роки тому +1

      ek or function bana k solve kar le

  • @sourav_Barbigahiya
    @sourav_Barbigahiya 2 роки тому +1

    *Thank you Dii*

  • @meme_eternity
    @meme_eternity Рік тому

    we can see inorder for better checking

  • @vramanrs
    @vramanrs 2 роки тому +4

    clear explanation thank you

  • @parallax8916
    @parallax8916 Рік тому

    class Solution {
    public:
    TreeNode* addNode(int l,int r,vector& nums){
    if(l>r) return NULL;
    int mid=(l+r)/2;
    TreeNode* root=new TreeNode(nums[mid]);
    root->left=addNode(l,mid-1,nums);
    root->right=addNode(mid+1,r,nums);
    return root;
    }
    TreeNode* sortedArrayToBST(vector& nums) {
    return addNode(0,nums.size()-1,nums);
    }
    };

  • @satender5389
    @satender5389 3 роки тому +1

    Matlab doubt clear karne ka ya DISCUSSION ka koi telegram channel ya aur kuch hai kya ?

  • @wecodedaily7777
    @wecodedaily7777 3 роки тому +4

    Outstanding explanation 🔥

  • @techgianttechyforever
    @techgianttechyforever 3 роки тому +1

    thanks a lot mam

  • @devbhattacharya153
    @devbhattacharya153 2 роки тому

    Thanks a lot Maam!!! :)

  • @PujaKumari-nt5dq
    @PujaKumari-nt5dq Рік тому +1

    Do we have notes for Treee playlist?

  • @murapovyerkhan2439
    @murapovyerkhan2439 2 роки тому

    Strong brothers

  • @sgcreations5638
    @sgcreations5638 2 роки тому

    thanks for such a nice explanation.

  • @rishikagandhi
    @rishikagandhi 3 роки тому +1

    AVL trees approach ? Won't we used that?

  • @foodbankswat
    @foodbankswat Рік тому

    Anyone have solve this plz...
    Write an Array based implementation of BST?
    1. Insertion()
    2. Deletion()
    3. Search()
    4. Inorder(), PreOrder(), PostOrder()
    5. Height()
    6. Write a Function to find the number of nodes at a specific height (given by user).
    7. Write a function to count the leaf nodes in a BST......

  • @RajveerSingh-pr2ol
    @RajveerSingh-pr2ol 3 роки тому +4

    Aman bhaiya note nhi milta hai abhi 😔

  • @0x_minato4thh
    @0x_minato4thh 3 роки тому +2

    bhaiya ye animation bahut funny tha lekin😂😂😂😂😂😂

  • @sanketrajgiri3239
    @sanketrajgiri3239 3 роки тому +7

    Another name for this problem is "Building a BST from inorder sequence".

    • @Npanywayme
      @Npanywayme 3 роки тому

      But. Inorder se wo balance nhi hojata

    • @Npanywayme
      @Npanywayme 3 роки тому

      Compulsory nhi hai ki inorder wala balance tree ho

    • @armankang783
      @armankang783 9 місяців тому

      @@Npanywayme usne ye ni bola ki inorder se balance ho jaega, he said build a balanced tree from inorder sequence which is itself a sorted sequence

  • @iemmadhav
    @iemmadhav 3 роки тому +1

    Apni kaksha pe bhi content daal do please

  • @raunaqsingh875
    @raunaqsingh875 2 роки тому

    Very good explanation

  • @ayushshrivastava3838
    @ayushshrivastava3838 3 роки тому +1

    bhaiya mai abhi 12 class mai hu mai apneee colege ke first year sai aaapki c++ coading learn kr luga
    .

    • @StoryGicRohit
      @StoryGicRohit 3 роки тому +1

      Please Do learn bro .. You wont regret even if you give 1 hr a day you will build a very strong future for you (if you found programming is for you**)

  • @sleepypanda7172
    @sleepypanda7172 3 роки тому +1

    class Solution {
    public:
    TreeNode* func(TreeNode* &root, int ele)
    {
    if(!root)
    return root= new TreeNode(ele);
    if(root->val>ele)
    {
    root->left= func(root->left,ele);
    }
    else
    {
    root->right= func(root->right,ele);
    }
    return root;
    }
    TreeNode* bstFromPreorder(vector& preorder) {
    TreeNode*root= NULL;
    for(auto x:preorder)
    {
    func(root,x);
    }
    return root;
    }
    };

  • @kapil4457
    @kapil4457 2 роки тому +3

    Hello EveryBody...If you are looking for the code..here it is :
    TreeNode * ans(vectortrav , int start , int end){
    if(start > end){
    return NULL;
    }
    int mid =( start + end) / 2;
    int midEle = trav[mid];
    TreeNode *root = new TreeNode(midEle);
    root->left = ans(trav , start , mid-1);
    root->right = ans(trav , mid+1 , end);

    return root;
    }

    //Inorder Traversal
    void inorder(TreeNode * root , vector & trav){
    if(root==NULL){
    return;
    }
    inorder(root->left , trav );
    trav.push_back(root->val);
    cout

    • @foodbankswat
      @foodbankswat Рік тому

      Anyone have solve this plz...>
      **Write an Array based implementation of BST?
      1. Insertion()
      2. Deletion()
      3. Search()
      4. Inorder(), PreOrder(), PostOrder()
      5. Height()
      6. Write a Function to find the number of nodes at a specific height (given by user).
      7. Write a function to count the leaf nodes in a BST......**

  • @ritwickrana3255
    @ritwickrana3255 2 роки тому +1

    i think these videos are getting less likes as i am moving forward in this channel
    i guesss this is because students are leaving as course is moving ;

  • @The_Empire_Vstech
    @The_Empire_Vstech 3 роки тому +2

    Hellow aman bhaya i have got some error exactly same code i have run which has been tought
    I have try to find the solution in google but not found. Can u provide me the solution aur why it is happening

    • @aakashgoswami2356
      @aakashgoswami2356 3 роки тому

      class Solution {
      public:
      TreeNode* makeBST(vector&nums,int start,int end){
      if(start>end)
      return NULL;
      int mid = (start+end)/2;
      TreeNode *root = new TreeNode(nums[mid]);
      root->left = makeBST(nums,start,mid-1);
      root->right = makeBST(nums,mid+1,end);
      return root;
      }

      TreeNode* sortedArrayToBST(vector& nums) {
      TreeNode *res = makeBST(nums,0,nums.size()-1);
      return res;
      }
      };

  • @uday6717
    @uday6717 3 роки тому +4

    Kya koi bata skta hai ye didi kaun si hai😍😍😍

    • @rohanbhatia74
      @rohanbhatia74 3 роки тому +1

      Shraddha Di..😊

    • @sachinbairi6353
      @sachinbairi6353 3 роки тому

      @@rohanbhatia74 insta id?? hai kya

    • @melodytunes2204
      @melodytunes2204 3 роки тому +1

      @@sachinbairi6353 yr shayad se ye insta nahi chalati kyuki mene dhundne ki kaafi koshish ki thi lekin nhi mili

  • @vikashmahli1826
    @vikashmahli1826 3 роки тому +1

    Bhaiya class 12 jac ka computer science plzzz note video daaliye 🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏😭😭😭😭😭😂😂😂🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏😭😭😭😭😭😭😭😭😭😭😭😭😭😭😂😂😂😂🙏😂🙏😂🙏😂🙏😂🙏😂🙏😂🙏😂🙏😂🙏😂🙏😂🙏😭😭😭😭😭😭😭🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏plzzzzzzzzzzzzzzzzzzz

  • @ShivamcseIIITG
    @ShivamcseIIITG 3 роки тому

    🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏

  • @nn_yt24
    @nn_yt24 3 роки тому

    You have made a terrible mistake the diagram is wrong...the inorder traversal should be 10,20,30,40,50....and preorder would be 30,20,10,40,50