no need to do so much of hard work bro just sit down on a chair and you can share your screen and your cam its easy that way for both teacher and student. this is not some 11th 12th physics or maths class where seeing black baord is neccessary to focus
HI SIR , 1) sir pointer for the normal data types used to be initialised to addres like int *p = &x; right why for array its like this ie int * ptr = arr // pls explain how it works 2) for the two dimension one int (*p) [4] i didnt get this statement like are you declaring this pointer as an array to store 4 addresses ? THANKS for the reply and your tme
Sir could you please explain the programs of algorithm code with example , line by line with respect to example, like this 👇 , ( please sir 🙏) 👇 ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-zRza99HPvkQ.htmlsi=uPCCXgNFJjgO0gvw
I am getting this error what should I Do:mysqld: [ERROR] Failed to open required defaults file: C:\Program Files\MySQL\MySQL Server 8.0\bin\ mysqld: [ERROR] Fatal error in defaults handling. Program aborted!
Hello sir firstly thank you for all these sessions I have learnt every concept first time so far in this series from session 1 thanks to your teaching. The main reason i have continued this series was because of in depth teaching, pen and board, diagram, annotation, code explanation line by line, tracing algorithms, repetition. No other video explain as well as you. However this was the first session i have not understood first time as we went very fast, mainly the code part was hard to trace the concept. We also spent only few seconds on the rotation functions. I understand this course will be very long and we want to cover quickly but i think it will be too fast to cover by end of month. there is still soo much to cover that im worried quality will drop as a result. We have mention to cover: AVL Red and Black tree KD Tree Heaps Priority Queue Graph Theory Graph BFS DFS Dijikstra's Kruskals Prims Cycle detection directed and undirected Bellman-Ford Topological sort Kahns STL vectors maps sets Time and space complexity analysis Sorting algorithms Greedy algorithms Dynamic programming I think already it is alot to cover. sir please take your time no problem quality is much more important. many thanks
Sir can i use this logic for inserting at any position in linked list?? void InsertAtPosition(int val,int pos){ Node*n = new Node(val); Node*temp = head; int i = 0; while(i!=pos){ temp = temp->next; i++; } n->next = temp->next; temp->next = n;
Sir, I noticed that in the Binary Search code, setting end = arr.size() may cause issues when the key is at the end of the array. The current approach doesn't seem to return the correct index of the key. I've tried it out, and the key isn't found in some cases.
yess I corrected that mistake!! thanks for pointing that mistake out! now the code runs fine, i have made the change were the end is at n-1 rather than n.
Sir I maked getter and setter function combined....😄. private: int a = 10; public: int gseta(int x=-1){ //getter and setter function if(x==-1){ x = a; return x; } a = x; return a; }
Linear Search: #include <iostream> using namespace std; int LinearSearch(int arr[], int size, int key) { for(int i=0;i<size;i++) //so that the array can be travesed { if(arr[i] == key) //checking if the element is found { cout << "Element is on index: "; return i; //returning the index } } return -1; //if the element is not found then return -1! } int main() { int n; //for the size of the array cout << "Enter the Size of the Array: "; cin >> n; cout << "Please Enter " << n << " Elements in the Array: " << endl; int arr[n]; for(int i=0;i<n;i++) //to take the input in the array { cin >> arr[i]; } int key; //so that the element that needs to be searched can be asked by the user. cout << "Enter the Element to be Searched: "; cin >> key; cout << LinearSearch(arr, n, key); //calling the Linear Search function } Binary Search: //In Binary Search the array needs to be sorted first #include<iostream> using namespace std; int binarySearch(int arr[], int n, int key) { int start=0; int end=n-1; while(start<=end) { int mid = (start+end)/2; //finding mid element if(arr[mid]==key) // checking if target value is equal to mid { return mid; } else if(arr[mid]>key) //if the key is less than mid means its before mid! { end = mid-1; } else //otherwise element is present before mid element { start=mid+1; } } return -1; } int main() { int n; cout << "Enter the Size of the Array: "; cin >> n; int arr[n]; cout << "Enter the Sorted Array: "; for(int i=0;i<n;i++) { cin >> arr[i]; } int key; cout << "Enter the element you want to search: "; cin >> key; cout << binarySearch(arr,n,key) << endl; }
Here's todays code guys: #include <iostream> #include <queue> using namespace std; // Node structure for AVL Tree class Node { public: int key; Node* left; Node* right; int height; Node(int k) { key = k; left = nullptr; right = nullptr; height = 1; // height of a new node is 1 } }; // AVL Tree class class AVLTree { private: Node* root; // Helper function to get the height of a node int getHeight(Node* node) { if (!node) return 0; // Return 0 if the node is null return node->height; // Otherwise, return the node's height } // Helper function to get the balance factor of a node int getBalance(Node* node) { if (!node) return 0; // If the node is null, return balance as 0 int leftHeight = getHeight(node->left); // Get height of left subtree int rightHeight = getHeight(node->right); // Get height of right subtree return leftHeight - rightHeight; // Balance factor is the difference } // Helper function to right rotate subtree rooted with y Node* rightRotate(Node* y) { Node* x = y->left; Node* T2 = x->right; // Perform rotation x->right = y; y->left = T2; // Update heights y->height = max(getHeight(y->left), getHeight(y->right)) + 1; x->height = max(getHeight(x->left), getHeight(x->right)) + 1; // Return new root return x; } // Helper function to left rotate subtree rooted with x Node* leftRotate(Node* x) { Node* y = x->right; Node* T2 = y->left; // Perform rotation y->left = x; x->right = T2; // Update heights x->height = max(getHeight(x->left), getHeight(x->right)) + 1; y->height = max(getHeight(y->left), getHeight(y->right)) + 1; // Return new root return y; } // Helper function to recursively insert a key into the AVL tree Node* insertRec(Node* node, int key) { // 1. Perform the normal BST insert if (node == nullptr) { return new Node(key); } if (key < node->key) { node->left = insertRec(node->left, key); } else if (key > node->key) { node->right = insertRec(node->right, key); } else { // Equal keys not allowed in BST return node; } // 2. Update the height of this ancestor node node->height = 1 + max(getHeight(node->left), getHeight(node->right)); // 3. Get the balance factor of this ancestor node to check whether this node became unbalanced int balance = getBalance(node); // If this node becomes unbalanced, then there are 4 cases // Left Left Case if (balance > 1 && key < node->left->key) return rightRotate(node); // Right Right Case if (balance < -1 && key > node->right->key) return leftRotate(node); // Left Right Case if (balance > 1 && key > node->left->key) { node->left = leftRotate(node->left); return rightRotate(node); } // Right Left Case if (balance < -1 && key < node->right->key) { node->right = rightRotate(node->right); return leftRotate(node); } // Return the (unchanged) node pointer return node; } // Helper function to perform inorder traversal of the AVL tree void inorderRec(Node* root) { if (root != nullptr) { inorderRec(root->left); cout << root->key << " "; inorderRec(root->right); } } // Helper function to perform level-order traversal (BFS) using a queue void bfsHelper(Node* root) { if (root == nullptr) { return; } queue<Node*> q; q.push(root); while (!q.empty()) { Node* current = q.front(); q.pop(); cout << current->key << " "; if (current->left != nullptr) { q.push(current->left); } if (current->right != nullptr) { q.push(current->right); } } } public: AVLTree() { root = nullptr; } // Public method to insert a key into the AVL tree void insert(int key) { root = insertRec(root, key); } // Public method to perform inorder traversal of the AVL tree void inorderTraversal() { inorderRec(root); cout << endl; } // Public method to perform Breadth-First Search (BFS) traversal of the AVL tree void bfsTraversal() { bfsHelper(root); cout << endl; } }; // Main function to test the AVL tree implementation int main() { AVLTree avl; // Insert some keys into the AVL tree avl.insert(10); avl.insert(20); avl.insert(30); avl.insert(40); avl.insert(50); avl.insert(25); // Perform inorder traversal of the AVL tree cout << "Inorder traversal of AVL tree: "; avl.inorderTraversal(); // Perform BFS traversal of the AVL tree cout << "BFS traversal of AVL tree: "; avl.bfsTraversal(); return 0; }
Sir is this also kinda polymorphism when we declare variables in different scopes or blocks in a program?? like a = 1 in differnt function and a = 2 in different function??
So every time you create an object you will assign all the attributes manually? Suppose there are 100 cars and all the cars have to be assigned 3 attributes, ultimately you will end up writing 300 lines of code...! Are you not violating the most important principle of Engineering: DRY : Don't Repeat Yourself...! So, the constructor forces the user to assign the attributes/properties directly during object/instance creation, thereby saving lots of time. Therefore, rather than 300 lines you will only write 100 lines for the 100 objects. Hope this clears your doubt. 😊
with the help of constructors u can initialize an object when u create it!...rather than hard coding it into the code when u made the attribute!....its a very crucial part of OOPs concept because a constructor is the one who creates the object in the program.. from the class
sir from roadmap 36:56 there is search sorting algorithms ect i have tried to find this recording i cannot find. will we be covering this ? thank u very much
@CodersArcade at 34:40 for the step 3 there is mention of searching algorithms, sorting algorithms and miscellaneous algorithms. maybe like binary search algorithm, quicksort ect. i could not find live recording for this many thanks
hi i am learning alot from this course your explanations are best, i am preparing for interviews, i have one question will there be practise problems we can do for these topics we are learning like leetcode style where you will guide answer?
yess once we finish this course we will do interview problems also!! soo stay tuned for it and thanku soo much!....all your love and support helps us to grow even bigger and it motivates us to keep brining such concepts more and more!
Here is the Code for Today's Class: #include <iostream> #include<queue> using namespace std; // Define a node structure for the BST class Node { public: int key; Node* left; Node* right; Node(int k) { key = k; left = nullptr; right = nullptr; } }; // Binary Search Tree class class BST { private: Node* root; // Helper function to recursively insert a key into the BST Node* insertRec(Node* root, int key) { if (root == nullptr) { root = new Node(key); return root; } if (key < root->key) { root->left = insertRec(root->left, key); } else if (key > root->key) { root->right = insertRec(root->right, key); } return root; } // Helper function to recursively search for a key in the BST bool searchRec(Node* root, int key) { if (root == nullptr) { return false; } if (root->key == key) { return true; } else if (key < root->key) { return searchRec(root->left, key); } else { return searchRec(root->right, key); } } // Helper function to perform inorder traversal of the BST void inorderRec(Node* root) { if (root != nullptr) { inorderRec(root->left); cout << root->key << " "; inorderRec(root->right); } } // Helper function to perform level-order traversal (BFS) using a queue void bfsHelper(Node* root) { if (root == nullptr) { return; } queue<Node*> q; q.push(root); while (!q.empty()) { Node* current = q.front(); q.pop(); cout << current->key << " "; if (current->left != nullptr) { q.push(current->left); } if (current->right != nullptr) { q.push(current->right); } } } // Helper function to find the minimum node in a subtree Node* findMin(Node* node) { Node* current = node; while (current && current->left != nullptr) { current = current->left; } return current; } // Helper function to recursively delete a key from the BST Node* deleteRec(Node* root, int key) { if (root == nullptr) { return root; } if (key < root->key) { root->left = deleteRec(root->left, key); } else if (key > root->key) { root->right = deleteRec(root->right, key); } else { // Node to be deleted found // Case 1: No child or one child if (root->left == nullptr) { Node* temp = root->right; delete root; return temp; } else if (root->right == nullptr) { Node* temp = root->left; delete root; return temp; } // Case 2: Node with two children Node* temp = findMin(root->right); // finding inroder successor, to maintain bst properties root->key = temp->key; root->right = deleteRec(root->right, temp->key); } return root; } public: BST() { root = nullptr; } // Public method to insert a key into the BST void insert(int key) { root = insertRec(root, key); } // Public method to search for a key in the BST bool search(int key) { return searchRec(root, key); } // Public method to delete a key from the BST void remove(int key) { root = deleteRec(root, key); } // Public method to perform inorder traversal of the BST void inorderTraversal() { inorderRec(root); cout << endl; } // Public method to perform Breadth-First Search (BFS) traversal of the BST void bfsTraversal() { bfsHelper(root); cout << endl; } }; // Main function to test the BST implementation int main() { BST bst; // Insert some keys into the BST bst.insert(50); bst.insert(30); bst.insert(70); bst.insert(20); bst.insert(40); bst.insert(60); bst.insert(80); // Perform inorder traversal of the BST cout << "Inorder traversal of BST: "; bst.inorderTraversal(); // Perform BFS traversal of the BST cout << "BFS traversal of BST: "; bst.bfsTraversal(); // Search for a key in the BST int key = 60; if (bst.search(key)) { cout << key << " found in the BST." << endl; } else { cout << key << " not found in the BST." << endl; } // Delete a key from the BST key = 30; bst.remove(key); cout << "Inorder traversal after deleting " << key << ": "; bst.inorderTraversal(); // Search for a key not in the BST key = 90; if (bst.search(key)) { cout << key << " found in the BST." << endl; } else { cout << key << " not found in the BST." << endl; } return 0; }
The error code 0x8024402c typically indicates a network-related issue that might prevent Windows from accessing update servers, which can affect updating or checking your WSL version. You can try this: Open Settings > Update & Security > Troubleshoot > Windows Update. Run the troubleshooter to detect and fix issues with Windows Update services.
because in the constructor parameter, we have written parameter as 'data', which is exactly the same as the attribute of the class 'data', soo whenever u have same name attribute and constructor parameter we use this-> keyword, if u want to skip using this-> keyword then u have to change the attribute name or constructor parameter name from data to 'd' or u can choose any name of your choice, then u can say data=d; for example: class Node{ int data; // here on of the attribute of the class is named as 'data' Node* next; Node(int d){ // you see here i have taken parameter as 'd' rather than 'data' data = d; // soo now i can skip using this-> keyword next = nullptr; } } conclusion:-> soo in the above example u saw that now i have taken data as the attribute of the class and in the constructor parameter i have taken d as the parameter of the constructor....soo now i can skip using this->keyword Finally, soo now remember!! that whenever we have the attribute name and the constructor parameter name same, then we use this->keyword, if u have changed the attribute name or the constructor parameter then u dont have to use this->keyword I HOPE SOO THAT THIS SOLVED YOUR DOUBT!! I have explained this in more detailed in this video: ru-vid.comRH2dlOlrd9M go to 26:09 of this video and learn it properly u will get your explaination correctly!
@vivekraghuwanshi9756 you should watch ru-vid.com/group/PLx4LEkEdFArhgQq7BqX4e2MK3Cm70wRmO&si=CR8Q4thej95y4V2Q this playlist and u will master c++ OOPs concepts!
if the problem is not getting solved then maybe there might be an issue in the minGw installation or u may not have searched for gcc.exe path properly... it might be possible soo check that once please... if the problem persists then please let us know for further assistance!
Ensure Hyper-V is Enabled (For Windows Users) Docker Desktop on Windows uses Hyper-V for virtualization, so it's essential that it's enabled: Go to Control Panel > Programs > Turn Windows features on or off. Ensure that Hyper-V is checked, including Hyper-V Management Tools and Hyper-V Platform. Also, make sure Virtual Machine Platform and Windows Hypervisor Platform are enabled. Restart your computer after making any changes.