🚀 Day 25 of #100DaysOfDSA (Java) Today I explored Queue, an important linear data structure that follows the FIFO (First In First Out) principle. Covered: 🔹 Introduction to Queue 🔹 Queue implementation using arrays and Linked List 🔹 Queue operations (enqueue, dequeue, peek) 🔹 Circular Queue concept 🔹 Understanding difference between Stack and Queue Key takeaway: Unlike stacks, queues process elements in order, making them useful for scheduling, buffering, and real-world scenarios like task management systems. Also learned how queues are widely used in algorithms like Breadth-First Search (BFS). Day 25 ✅ Expanding understanding of core data structures. #DSA #Java #Queue #DataStructures #100DaysOfCode #ProblemSolving #DeveloperJourney #LearningInPublic
Exploring Queue Data Structure in Java
More Relevant Posts
-
🧠 A small tip when designing REST APIs When designing REST APIs, it’s very common to return entities directly from the database. However, this can create problems such as: ⚠️ Exposing internal fields ⚠️ Tight coupling between API and database models ⚠️ Serialization issues with lazy-loaded relationships 🚀 A better approach is using DTOs (Data Transfer Objects). Example: Instead of returning the entity: Order Return a response model like: OrderResponse This helps you: ✅ Control exactly what the API exposes ✅ Keep your domain model clean ✅ Avoid serialization problems 💬 Do you usually return entities directly, or do you prefer using DTOs? #Java #SpringBoot #RESTAPI #BackendDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
🚀 Day 40 of #100DaysOfDSA (Java) Today was focused on practicing Graph concepts. I attended a live session with my mentor where I: 🔹 Solved graph-based problems using BFS & DFS 🔹 Practiced traversal and path-related questions 🔹 Improved my understanding of graph problem-solving strategies Key takeaway: Graphs require strong conceptual clarity, and solving problems with guidance helps in building the right approach. Practicing BFS and DFS is helping me understand how to explore nodes efficiently and solve connectivity problems. Day 40 ✅ Focused on practice, consistency, and improving problem-solving skills. #DSA #Java #Graphs #BFS #DFS #ProblemSolving #100DaysOfCode #DeveloperJourney #LearningInPublic #Consistency
To view or add a comment, sign in
-
-
🚀 Day 38/50 – #50DaysOfCode Today, I learned about ArrayList operations — concatenation, slicing, converting between arrays and ArrayLists, and the comparison between Array and ArrayList. Understanding these differences helps in choosing the right data structure effectively. ☕💻 #Day38 #JavaFullStack #Java #CCBP #NxtWave #LearningJourney #Consistency
To view or add a comment, sign in
-
🔥 Day 61/100 — #100DaysDSAChallenge Today I worked on a classic problem: Implement Queue using Stacks. 💡 The key idea We use two stacks: 1. One stack for input (push operations) 2. One stack for output (pop/peek operations) When we need to remove an element: If the output stack is empty, we move all elements from input stack to output stack This reverses the order Now the oldest element is on top and ready to be removed ⚙️ Complexity ⏱️ Amortized Time: O(1) 💾 Space: O(n) 🧠 What I learned today Today’s lesson was about reversing data flow to achieve a different behavior. #Java #DSA #Stack #Queue #LeetCode #ConsistencyCurve
To view or add a comment, sign in
-
-
🚀 Day 36 of #128DaysOfCode Focused on improving problem-solving skills and understanding how to optimize solutions using the right data structures. 🔹 Practiced using HashSet for fast lookups 🔹 Learned how to handle duplicates efficiently 🔹 Improved logic-building step by step instead of jumping to code 🔹 Got more clarity on converting data structures (List → Array) 💡 Key takeaway: Choosing the right approach can make a problem much simpler and more efficient. Staying consistent and building confidence day by day 💪 #Java #DSA #CodingJourney #PlacementPreparation
To view or add a comment, sign in
-
-
🚀Day 40 LeetCode 1161 – Maximum Level Sum of a Binary Tree Ever wondered how to find the level of a binary tree with the maximum sum of node values? 🤔 Here’s the idea: We traverse the tree level by level (BFS) and compute the sum at each level. The trick is to keep track of the maximum sum and return the smallest level where this occurs. 💡 Key Insight: Level-order traversal (using a queue) naturally processes nodes one level at a time, making it perfect for this problem. 🔧 Approach: ✔ Use a queue for BFS ✔ For each level: • Calculate sum of nodes ✔ Track maximum sum and corresponding level 🔥 Takeaway: Whenever a problem involves levels in a tree, think BFS first — it often leads to the cleanest solution. #LeetCode #DataStructures #Java #CodingInterview #BinaryTree #BFS #ProblemSolving
To view or add a comment, sign in
-
-
Today I Started Learning Linked Lists Today, I began a new topic in Data Structures: Linked List. 🔹 I learned about Dynamic Memory Allocation Stack memory (used at compile time) Heap memory (used at runtime) 🔹 Difference between Compile Time vs Runtime Compile time: Memory is allocated before execution Runtime: Memory is allocated during execution 🔹 Understanding Stack vs Heap Stack is faster and automatically managed Heap is flexible but requires manual management 🔹 Implemented basic Linked List operations in C: ✔ Creating nodes ✔ Traversing the list ✔ Counting the number of nodes 💡 Excited to explore more operations like insertion and deletion next! #DataStructures #LinkedList #Java #LearningJourney
To view or add a comment, sign in
-
🚀 Day 41 of #75DaysofLeetCode LeetCode 1161 – Maximum Level Sum of a Binary Tree Ever wondered how to find the level of a binary tree with the maximum sum of node values? 🤔 Here’s the idea: We traverse the tree level by level (BFS) and compute the sum at each level. The trick is to keep track of the maximum sum and return the smallest level where this occurs. 💡 Key Insight: Level-order traversal (using a queue) naturally processes nodes one level at a time, making it perfect for this problem. 🔧 Approach: ✔ Use a queue for BFS ✔ For each level: • Calculate sum of nodes ✔ Track maximum sum and corresponding level ⏱ Complexity: • Time: O(n) • Space: O(n) 🔥 Takeaway: Whenever a problem involves levels in a tree, think BFS first — it often leads to the cleanest solution. #LeetCode #DataStructures #Java #CodingInterview #BinaryTree #BFS #ProblemSolving 🚀 LeetCode 1161 – Maximum Level Sum of a Binary Tree Ever wondered how to find the level of a binary tree with the maximum sum of node values? 🤔 Here’s the idea: We traverse the tree level by level (BFS) and compute the sum at each level. The trick is to keep track of the maximum sum and return the smallest level where this occurs. 💡 Key Insight: Level-order traversal (using a queue) naturally processes nodes one level at a time, making it perfect for this problem. 🔧 Approach: ✔ Use a queue for BFS ✔ For each level: • Calculate sum of nodes ✔ Track maximum sum and corresponding level ⏱ Complexity: • Time: O(n) • Space: O(n) 🔥 Takeaway: Whenever a problem involves levels in a tree, think BFS first — it often leads to the cleanest solution. #LeetCode #DataStructures #Java #CodingInterview #BinaryTree #BFS #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 35/50 – #50DaysOfCode Today, I learned about array concatenation, array slicing, and multidimensional arrays in Java, along with how to iterate over multidimensional arrays. These concepts help in handling complex data structures more efficiently. ☕💻 #Day35 #JavaFullStack #Java #CCBP #NxtWave #LearningJourney #Consistency
To view or add a comment, sign in
-
Day 83/100 🚀 | #100DaysOfDSA Solved LeetCode 225 – Implement Stack using Queues today. The problem was to implement stack operations (LIFO) using only queue operations (FIFO). Approach: Used a single queue with rotation technique. • For push(x): Added the element to the queue Rotated the queue by moving previous elements to the back This ensures the newest element comes to the front (stack top) • For pop(): Simply removed from the front of the queue • For top(): Returned the front element • For empty(): Checked if queue is empty This way, the queue always maintains stack order. Time Complexity: • push → O(n) • pop → O(1) • top → O(1) Space Complexity: O(n) Key takeaway: By reordering elements during insertion, we can simulate stack behavior using a single queue efficiently. #100DaysOfDSA #LeetCode #DSA #Java #Queue #Stack #ProblemSolving #Consistency
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