🚀 Day 7 of my DSA journey Making real progress! Today was all about moving beyond the 'for' loop and diving deep into the fundamentals of Recursion. 💻 Recursion is a technique where a function calls itself to solve a problem by breaking it down into smaller, identical sub-problems. ✅ The Anatomy of Recursion: 🔹 Base Case: Your exit strategy. The mandatory condition that stops the cycle once the goal is reached. 🔹 Recursive Step: The logic where the function calls itself with a modified input, moving closer to the base case. 🔹 The Call Stack: The memory’s "waiting room." Every call sits on top of the previous one until the base case is hit and the stack "unwinds." ⚠️ Where It Goes Wrong: Stack Overflow: When the "waiting room" gets too full; too many calls without an exit will crash the memory. Infinite Loops: The result of a missing or unreachable base case, causing the program to hang. Excited to start solving recursion problems from tomorrow! 🚀 The goal has evolved: From simple loops to recursive logic, keeping the complexity low. On to Day 8! ➡️ #Day7 #JavaScript #DSA #LeetCode #Recursion #CodingJourney #LearningInPublic
Mastering Recursion in DSA
More Relevant Posts
-
🚀 Day 5 of my DSA journey Building on the momentum! Today was all about using mathematical logic to solve array-based problems efficiently. 💻 ✅ Problems Solved & Key Takeaways: 1️⃣ Missing Number 🔹 Approach: Used the arithmetic series formula to calculate the expected sum of all numbers and subtracted the actual sum of the array to find the missing value. 🔹Learning: I learned that comparing an expected total against an actual total is a brilliant trick for identifying gaps in a sequence without needing to sort the data first. The goal remains the same: Stay consistent and keep optimizing. On to Day 6! ➡️ #Day5 #JavaScript #DSA #LeetCode #CodingJourney #LearningInPublic #SoftwareEngineering
To view or add a comment, sign in
-
🚀 DSA Day 17: From Theory to Code – Building the Foundation 🏗️ Today was a busy one, but I made sure to squeeze in some growth time. I focused on the "blueprint" of a Singly Linked List: ✅ The Node Factory: Created a constructor to give every piece of data its own value and a next pointer. ✅ The Structure: Initialized my MyLinkedList class with a head, tail, and a length tracker to keep things organized. It’s a simple start, but it’s the skeleton that makes everything else possible. 🔜 Coming up next: The "heavy lifting" begins! I’ll be tackling: 🔹 Get: How to find a value at a specific index (the "walk"). 🔹 Insert: Adding new nodes without breaking the chain. 🔹 Delete: Removing nodes and re-linking the pointers. The goal isn't just to write the code, but to visualize how those pointers shift in memory. 🧠✨ #Day17 #JavaScript #DSA #CodingJourney #LinkedList #LearningInPublic #WebDev #DataStructures #Consistency
To view or add a comment, sign in
-
🚀 Day 6/100 – #100DaysOfDSA Today’s focus was on searching vs sorting and understanding efficiency differences. 🔹 Problems Solved: 1. Binary Search 2. Bubble Sort 💡 Key Learnings: 👉 Problem 1: Binary Search Works only on sorted arrays Divide the search space into half each time 👉 Approach: Find mid index Compare with target Move left or right accordingly ✅ O(log n) Time Complexity ✅ Very efficient for large datasets 👉 Problem 2: Bubble Sort Most people implement Bubble Sort, but today I learned how to optimize it using an early break condition 🚀 👉 Approach: If no swaps happen in a pass, the array is already sorted — so we can stop early instead of continuing unnecessary iterations. ✅O(n) (Optimized with swap flag) 🔥 What I learned today: Choosing the right algorithm matters more than just solving the problem. Consistency continues 💪 Day 6 done! #100DaysOfCode #DSA #BinarySearch #Sorting #LeetCode #ProblemSolving #CodingJourney #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
Day 2: Leetcode – 704. Binary Search Today’s problem looked straightforward, but it exposed how small mistakes in control flow can completely break the logic. The Key Insight: Binary search isn’t just about comparing values — it’s about maintaining the correct search space and letting the loop run until it’s fully exhausted. Returning too early can silently ruin the entire algorithm. My Mistake: I placed return -1 inside the loop, which caused the function to exit after just one iteration if the target wasn’t found immediately. The code compiled fine but the logic was wrong — a good reminder that passing compilation doesn’t mean correctness. My Approach: Initialize low = 0 and high = n-1 Calculate mid each iteration Compare nums[mid] with target Adjust search space accordingly Only return -1 after the loop ends Takeaway: Binary search is simple in theory but demands discipline in implementation. One misplaced return or bracket can turn a correct idea into a faulty solution. Day 2 Completed #LeetCode #DSA #BinarySearch #Learning #CodingJourney
To view or add a comment, sign in
-
-
🚀 Day 23 of #60DaysOfDSA Today I implemented Quick Sort, a powerful Divide & Conquer algorithm used for sorting. 🔍 What I learned: Quick Sort works by selecting a pivot element It partitions the array into: Elements smaller than pivot Elements greater than pivot Then recursively sorts both parts ⚡ Key Insight: “Partitioning is the heart of Quick Sort.” Even a small mistake in index handling or swapping can completely break the logic. 💻 Key Concepts Covered: ✔️ Pivot selection (last element) ✔️ Partition logic (Lomuto method) ✔️ Recursion ✔️ In-place sorting 🧠 Takeaway: Quick Sort is not just about writing code, it’s about understanding how elements move and how recursion divides the problem. Consistency > Perfection 🚀 One step closer to becoming better every day! #DSA #QuickSort #CodingJourney #JavaScript #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 7/100 – #100DaysOfDSA One week in! 🎯 Today I focused on understanding basic sorting algorithms and how they work internally. 🔹 Problems Covered: 1. Selection Sort 2. Insertion Sort 💡 Key Learnings: 👉 Selection Sort Repeatedly find the minimum element from the unsorted part Place it at the correct position ✅ Time Complexity: O(n²) ✅ Space Complexity: O(1) (In-place) 👉 Insertion Sort Build the sorted array one element at a time Insert each element into its correct position ✅ Time Complexity: Best: O(n) (already sorted) Average/Worst: O(n²) ✅ Space Complexity: O(1) 🔥 What I learned today: Both algorithms are simple and useful for learning, but Insertion Sort performs better for partially sorted arrays, while Selection Sort always takes the same time. Understanding these basics helps in mastering advanced sorting algorithms later 🚀 Week 1 complete ✅ Consistency continues! #100DaysOfCode #DSA #Sorting #SelectionSort #InsertionSort #CodingJourney #ProblemSolving #JavaScript #TechGrowth #SoftwareEngineer #LearningInPublic
To view or add a comment, sign in
-
🚀 Day 3/100 – #100DaysOfDSA Another day, more learning, and deeper understanding of in-place algorithms! 🔹 Problems Solved: Move Zeroes Merge Sorted Array 💡 Key Learnings: 👉 Problem 1: Move Zeroes Applied Two Pointer Technique One pointer tracks position for next non-zero element Another pointer iterates through the array Swap only when needed to maintain order ✅ Maintains relative order ✅ In-place (O(1) space) ✅ O(n) Time Complexity 👉 Problem 2: Merge Sorted Array Solved using reverse two-pointer approach Start filling from the end of nums1 (to avoid overwriting elements) Compare elements from nums1 and nums2, and place the larger one at the end ✅ Efficient merge without extra array ✅ O(m + n) Time ✅ In-place solution 🔥 What I learned today: Sometimes solving from the end instead of the beginning makes the problem much simpler and avoids unnecessary complexity. Consistency is building momentum. Day 3 done ✅ #100DaysOfCode #DSA #LeetCode #ProblemSolving #CodingJourney #SoftwareEngineer #JavaScript #TechGrowth #LearningInPublic #Developers
To view or add a comment, sign in
-
🚀 Solved: Valid Parentheses (Stack Based Problem) Today I worked on a classic problem that looks simple but tests your core logic 👇 🧠 Problem: Given a string containing only (), {}, [] 👉 Check if the parentheses are valid 💡 Approach I used: Used a stack Push opening brackets For closing brackets: Check top of stack If match → pop Else → invalid ⚙️ Key Insight: 👉 Order matters more than count 👉 Stack helps track the sequence correctly 🔥 What I learned: Importance of stack in real problems Handling edge cases (empty stack, mismatch) Writing clean conditional logic 📌 Time Complexity: O(n) 📌 Space Complexity: O(n) 💬 Have you solved this problem differently? Would love to know your approach! #javascript #cpp #datastructures #algorithms #coding #leetcode #interviewprep
To view or add a comment, sign in
-
-
Back to core DSA algorithms — building from the ground up. 🚀 Today I implemented: 🔹 Selection Sort Algorithm Problem: Sort an array by repeatedly selecting the minimum element and placing it at the correct position. Not the fastest algorithm (O(n²)), but that’s not the point right now. The goal is to understand: ✔ How sorting works internally ✔ How loops and comparisons build logic ✔ Why better algorithms exist Skipping basics is the biggest mistake. I’m not doing that. #DSA #JavaScript #Sorting #Algorithms #CodingJourney #Consistency
To view or add a comment, sign in
-
-
Day 1: LeetCode - 35. Search Insert Position Starting my DSA journey with a classic binary search problem. Sometimes the goal isn’t just to find an element, but to figure out where it belongs. The Key Insight: If the target is not present, the correct insert position is exactly where the binary search ends — the low pointer naturally points to that position. My Approach: Apply binary search on the sorted array Compare mid with target and adjust search space If not found, return low as the insert index Takeaway: Binary search is more than searching — it helps solve positioning problems efficiently. Time Complexity: O(log N) | Space Complexity: O(1) Day 1 completed. #DSA #BinarySearch #LeetCode #CodingJourney
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development