Tag

Nested Loops

1 views collected around this technical thread.

Architecture Digest
Architecture Digest
Feb 14, 2025 · Backend Development

Optimizing Nested Loops in Java: Using Break and Map for Faster Data Matching

This article demonstrates how to improve the performance of nested for‑loops that match user IDs between two large lists by adding a break statement and by converting the inner list into a hash map, reducing execution time from tens of seconds to a few seconds.

Data StructuresJavaNested Loops
0 likes · 7 min read
Optimizing Nested Loops in Java: Using Break and Map for Faster Data Matching
macrozheng
macrozheng
Dec 16, 2024 · Backend Development

Boost Java Loop Performance: Replace Nested Loops with a HashMap

This article demonstrates how to dramatically speed up Java code that matches items between two large lists by eliminating nested loops, using early‑exit with break and, more effectively, pre‑building a HashMap for O(1) lookups, with concrete timing results and full code examples.

HashMapJavaNested Loops
0 likes · 8 min read
Boost Java Loop Performance: Replace Nested Loops with a HashMap
Architecture Digest
Architecture Digest
Apr 14, 2024 · Backend Development

Optimizing Nested Loops in Java: From O(N²) to O(N) Using HashMap

This article demonstrates how to replace a costly double‑for‑loop that matches two large lists of users with a HashMap lookup, showing performance measurements, the effect of adding a break statement, and detailed Java code examples for backend developers.

HashMapJavaNested Loops
0 likes · 7 min read
Optimizing Nested Loops in Java: From O(N²) to O(N) Using HashMap
Python Programming Learning Circle
Python Programming Learning Circle
Jul 22, 2022 · Fundamentals

Techniques for Exiting Nested Loops in Python

This article explains several methods to break out of nested loops in Python, including using identical break conditions, flag variables, raising exceptions, combining else clauses, and leveraging function returns, illustrated with a prime-number game example and complete code snippets.

Exception HandlingNested LoopsPython
0 likes · 6 min read
Techniques for Exiting Nested Loops in Python
Python Programming Learning Circle
Python Programming Learning Circle
Jan 24, 2022 · Fundamentals

Techniques to Exit Nested Loops in Python

This article explains several Python techniques—using identical break conditions, flag variables, exceptions, loop‑else clauses, and function returns—to exit nested loops, demonstrated through a prime‑number game where the program stops when a non‑prime input is entered.

Exception HandlingNested LoopsPython
0 likes · 6 min read
Techniques to Exit Nested Loops in Python
Python Programming Learning Circle
Python Programming Learning Circle
Jan 16, 2020 · Fundamentals

How to Copy Lists and Generate a 9×9 Multiplication Table in Python

This article demonstrates two basic Python examples: copying a list using slicing and printing the full 9×9 multiplication table with nested loops, including the complete source code and expected output for each case.

Nested LoopsPythonbasic programming
0 likes · 3 min read
How to Copy Lists and Generate a 9×9 Multiplication Table in Python