Thirumalaitthirruu.hashnode.dev·Apr 8, 2024Binary Search TreesHow to create a Node ? class Node{ int data; Node left; Node right; public Node(data){ this.data = data; } } How to create a Binary Search Tree? public class BinaryTree{ Node root; public void insert(int data){ root = insertRec(root,data); } pub...Discuss·1 likeData Structure and AlgorithmsDSA
Himanshu Chauhanhimanshuchauhan.hashnode.dev·Apr 7, 2024Day 50: Tree data structure using PythonA tree data structure is a hierarchical data structure consisting of nodes connected by edges. It's called a "tree" because it resembles an upside-down tree with its root at the top and branches extending downward. Basic Concepts: Nodes: Elements in...DiscussPython
Ishan Vaghelaishanv5.hashnode.dev·Apr 5, 2024Data Structures - Best Way To Build Your LogicThis Blog contains all concept of data structures which can be easily remember . Behind every click, swipe, and search, there's a complex dance of data and instructions. Data structures and algorithms are the choreography that makes it all work. What...Discuss·38 readsDynamic Programming
Akshay Pariharakshayparihar.hashnode.dev·Mar 30, 202420 Coding Patters to Ace coding InterviewsTwo Pointers It is used when we need to find pairs or sub-arrays in an array that satisfy a certain condition, or when we need to find a specific element in a sorted array. Typically, the two pointers advance towards opposite ends of the data structu...Discussdata structure and algorithms
Aditya Jadhavjadhavaditya.tech·Jan 28, 2024Data structures and algorithmsWhat is Data Structure? A data structure is defined as a particular way of storing and organizing data in our devices to use the data efficiently and effectively. The main idea behind using data structures is to minimize the time and space complexiti...Discussporblem solving
Kallol Bairagikallolbairagi.hashnode.dev·Oct 21, 2023#102.Binary Tree Level Order Traversal [LeetCode Grind 75 in Java]class Solution { public List<List<Integer>> levelOrder(TreeNode root) { List<List<Integer>> ans = new ArrayList<List<Integer>>(); Queue<TreeNode> queue = new LinkedList<>(); queue.add(root); if(root == null) retu...DiscussLeetCode Grind 75 in JavaDSA
Kallol Bairagikallolbairagi.hashnode.dev·Oct 16, 2023#235.Lowest Common Ancestor of a Binary Search Tree [LeetCode Grind 75 in Java]class Solution { public TreeNode lowestCommonAncestor(TreeNode root, TreeNode p, TreeNode q) { //check on the left side if(root.val > p.val && root.val > q.val) return lowestCommonAncestor(root.left, p, q); //c...DiscussLeetCode Grind 75 in JavaDSA
Kallol Bairagikallolbairagi.hashnode.dev·Oct 8, 2023#104.Maximum Depth of Binary Tree [LeetCode Grind 75 in Java]class Solution { public int maxDepth(TreeNode root) { if(root == null) return 0; //BFS traversal Queue<TreeNode> q = new LinkedList<TreeNode>(); q.add(root); int depth = 0; while(!q.isEmpty()){ ...DiscussLeetCode Grind 75 in JavaDSA
Kelyn Njeriblog.kelynnjeri.me·Oct 1, 2023A Theoretical Guide To Trees - Part 1Introduction Trees are fundamental data structures used in computer science and software engineering to represent hierarchical relationships between objects. This comprehensive guide aims to provide a practical understanding of trees, their essential...Discuss·394 readsData Structure And Algorithmsdata structures
Preetika Prakashpreetikaprakash.hashnode.dev·Aug 29, 2023DSA Day 83/100Topic: Tree 1) Determine if Two Trees are IdenticalEasy RECURSIVE SOLUTION Input: 1 1 / \ / \ 2 3 2 3 Output: Yes Explanation: There are two trees both having 3 nodes and 2 edges, both trees are identical havin...Discuss100DaysOfCode