Algorithms

Master the essential Algorithms

Tree Traversals

Table of Contents 📚 Introduction to Tree Traversals Traversal is a fundamental operation in which we visit all the nodes of a tree and perform some operation (such as a print operation) at each node. In this post, we’ll discuss three commonly used traversals for binary trees: in-order, pre-order, and post-order. In-order Traversal In in-order […]

Tree Traversals Read More »

Iteration vs Recursion

Both iteration and recursion are programming techniques used for repeating a set of instructions. Although they often can be used to solve the same problems, they have distinct characteristics and use-cases. Let’s explore the two concepts with examples in Java. Iteration Iteration uses looping constructs like for, while, or do-while to repeatedly execute a block

Iteration vs Recursion Read More »