Insertion in Binary Search Tree | Insertion in BST | Iteratively & Recursively | DSA-One Course #67

  Рет қаралды 44,422

Anuj Bhaiya

Anuj Bhaiya

Күн бұрын

Пікірлер: 35
@nittinrana2277
@nittinrana2277 2 жыл бұрын
Nice content thanks Bhaiya for uploading video more frequently
@AdilKhan-we3wb
@AdilKhan-we3wb 2 жыл бұрын
Thanks bhaiya... I was actually thinking and trying the code with iterative approach for the last 2 days.I have somewhat reached but still i was not able to complete the code. But now it is crystal clear.. The gem for iterative approach is the current and parent pointer ( i was coding in C ) .. Thanks a lot .
@pallavigavali2671
@pallavigavali2671 2 жыл бұрын
Thank you bhaiya ❤️
@tech_wizard9315
@tech_wizard9315 2 жыл бұрын
Please make a 60 roadmap on important DSA topics for DSA beginner to crack tech giant's like Microsoft Amazon level companies
@arpanmaheshwari2290
@arpanmaheshwari2290 2 жыл бұрын
Love you bhaiya first
@er.skelafahmed
@er.skelafahmed 2 жыл бұрын
Thanks bhaiya...for your uploading speed. ❤️
@vivekshokeen1192
@vivekshokeen1192 2 жыл бұрын
Bhaiya can you upload video on springboot briefly describing from interview perspective.Thanks for the amazing videos.love❤
@aishwaryshukla8880
@aishwaryshukla8880 2 жыл бұрын
Use this iterative code to pass all testcases of GFG: Node insert(Node root, int Key) { // your code here //Recursive method is commented out, iterative method is uncommented currently // if (root == null){ // return new Node(Key); // } // if (root.data > Key){ // root.left = insert(root.left, Key); // }else if (root.data < Key){ // root.right = insert(root.right, Key); // } // return root; Node newNode = new Node(Key); Node cur = root; Node parent = null; while (cur != null){ parent = cur; if (cur.data == Key) return root; //this line handles if K is already present in BST if (cur.data > Key) cur = cur.left; else cur = cur.right; } if (parent == null) { return newNode; } else if (parent.data < Key){ parent.right = newNode; }else parent.left = newNode; return root; }
@lavinamaheshwari
@lavinamaheshwari Жыл бұрын
Amazing explanation!
@sudhanshudubey7267
@sudhanshudubey7267 2 жыл бұрын
bhaiya please make detailed video on hackathons
@ashutosh7597
@ashutosh7597 Жыл бұрын
Best explaination
@abhaysingh7862
@abhaysingh7862 2 жыл бұрын
Thank u bhaiya
@abhishekdutta7064
@abhishekdutta7064 2 жыл бұрын
Nice explanation sir😌
@laughgenerator7907
@laughgenerator7907 2 жыл бұрын
Node insert(Node root, int Key) { Node newnode = new Node(Key); Node curr=root; Node parent=null; while(curr!=null){ parent=curr; if(Key
@harry-cf4ii
@harry-cf4ii 2 жыл бұрын
Bhaiya when can we expect this course to finish??and whats ur next plan after this DSA-one course?
@saritaprasad4295
@saritaprasad4295 2 жыл бұрын
Nice explanation
@v.k1454
@v.k1454 2 жыл бұрын
Sir prepare will tell me whether recorder app is hybrid or not nebread
@sumantagorai5880
@sumantagorai5880 4 ай бұрын
When insert an element already present inside the tree in this case the iteration logic provided in this video was not pass all test case of GFG, was it happened with others?
@sonasonali8583
@sonasonali8583 2 жыл бұрын
please add some more videos on android development tutorials.
@vikasprajapati6558
@vikasprajapati6558 2 жыл бұрын
bhaiya what is your other source of income now ? k
@apoorvvikramsinghrathore7189
@apoorvvikramsinghrathore7189 2 жыл бұрын
nice sir
@sourav_Barbigahiya
@sourav_Barbigahiya 2 жыл бұрын
Bhaiya kabtak complete karbaoge DSA course ❤️ Please reply
@kapiljetwani3540
@kapiljetwani3540 2 жыл бұрын
bhaiya can u plzz make a video on rabin karp and kmp pattern matching algo's with code i am finding it really difficult to understand😊😊
@divyanshiyadav9120
@divyanshiyadav9120 2 жыл бұрын
Bhaiya how long th is course will continue ❤️❤️
@saswatapatra5919
@saswatapatra5919 2 жыл бұрын
bhaiyya second code mei what is cur.key? if cur is a node type value then it shouldnt have an attribute named key right?
@RITIKSINGH-re5ne
@RITIKSINGH-re5ne 2 жыл бұрын
curr.data and parent.data aega vaha
@itspodify2021
@itspodify2021 2 жыл бұрын
Bhaiya pls GROUPON sde intern ke preparation se related kisi se experience share krwa dijiye 🙏🙏🙏🙏🙏🙏 KZbin pe Groupon ki prep ka koi content available nhi hai
@priyanshemarldluke5048
@priyanshemarldluke5048 2 жыл бұрын
Bhaiya flutter wali playlist start krona jaldi please
@ansh7256
@ansh7256 Жыл бұрын
Replace x and key with Key
@chandrakantmandal___
@chandrakantmandal___ 2 жыл бұрын
Python video bhaiya
@nirvanjain3021
@nirvanjain3021 2 жыл бұрын
can you please share code?
@bhushankorg5606
@bhushankorg5606 2 жыл бұрын
Node* insert(Node* root, int Key) { // Your code here if(root == NULL){ root = new Node(Key); return root; } Node *curr = root, *parent = root; while(curr != NULL){ parent = curr; if(Key == curr->data){ return root; } else if(Key < curr->data){ curr = curr->left; } else{ curr = curr->right; } } curr = new Node(Key); if(Key < parent->data){ parent->left = curr; } else{ parent->right = curr; } return root; }
@suimishaikh2908
@suimishaikh2908 2 жыл бұрын
Bhaiya I am new or muje pata nhi hai ki DSA eitna hi hai
@Daddyboltee
@Daddyboltee 2 жыл бұрын
where did i do wrong its been 25 min but i coudn't find it welcome if anybody give favor in it.. class Solution { // Function to insert a node in a BST. Node insert(Node root, int Key) { Node newnode = new Node(key); Node current = root; Node Parent = null; while(key != current.key){ Parent = current; if(key < current.key){ current = current.left; }else{ current = current.right; }if(Parent == null){ Parent = newnode; }elsif(key < Parent.key){ Parent.left = newnode; }else{ Parent.right = newnode; } return root; } }
@M10-r8q7h
@M10-r8q7h 7 ай бұрын
subs at the start are crazy🥲🥲
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
When you have a very capricious child 😂😘👍
00:16
Like Asiya
Рет қаралды 18 МЛН
AVL Trees & Rotations (Self-Balancing Binary Search Trees)
20:38
Back To Back SWE
Рет қаралды 361 М.
Insertion in a Binary Search Tree
17:42
CodeWithHarry
Рет қаралды 283 М.
L53. Largest BST in Binary Tree
17:27
take U forward
Рет қаралды 171 М.
Delete a node from Binary Search Tree
18:27
mycodeschool
Рет қаралды 1,2 МЛН
BAYGUYSTAN | 1 СЕРИЯ | bayGUYS
36:55
bayGUYS
Рет қаралды 1,9 МЛН