© 2025 LogicLabs
Browse all articles in this category
Procedure: If ar[j] > ar[j+1] then swap those elements When doing this, we'll observe that the largest element is going to the last of the array after every iteration. So there are n-i-1 elements that get sorted at the end of the array after each it...
Question: Middle of the Linked List For odd length Linkedlist, we'll be having only one middle element, while for the even length, we'll have 2 middle elements. In the question, they asked to return the 2nd node if there are 2 middle elements. Step-...
Insertion into BST or Construction of BST in both recursive and iterative approach Construction of BST is easy than it seems to be 🌻. We know that, the nodes which are less than the root are present in the left subtree and all the nodes which are gr...