Sitemap

Common problem-solving patterns

2 min readJan 15, 2023

--

Press enter or click to view image in full size

    Get Arivazhagan L’s stories in your inbox

    Join Medium for free to get updates from this writer.

  1. Iteration: This pattern involves using loops (such as for, while, or do-while) to repeatedly execute a block of code until a certain condition is met.
  2. Recursion: This pattern involves calling a function within itself to solve a problem. Recursion is often used for problems that can be broken down into smaller subproblems.
  3. Divide and Conquer: This pattern involves breaking a problem down into smaller subproblems and solving them independently. This pattern is often used in sorting algorithms like merge sort and quick sort.
  4. Dynamic Programming: This pattern is a combination of Divide and Conquer and Memoization. It involves breaking down a problem into smaller subproblems, solving them independently, and storing the results in a table to avoid re-computation.
  5. Greedy Algorithm: This pattern involves making the locally optimal choice at each stage with the hope of finding a global optimum.
  6. Backtracking: This pattern involves building a solution incrementally by choosing options that do not violate constraints and undoing choices that do violate the constraint.
  7. Brute Force: This pattern involves trying every possible solution and selecting the best one. This method can be very time-consuming and is typically used as a last resort.
  8. Searching: This pattern involves searching through a collection of items to find a specific item or group of items that meet certain criteria.
  9. Sorting: This pattern involves arranging a collection of items in a specific order. There are many different sorting algorithms available, each with its own strengths and weaknesses.
  10. Design pattern: This pattern is a general repeatable solution to a commonly occurring problem in software design. Some common design patterns in Java include the Singleton pattern, the Observer pattern, and the Factory pattern.

--

--

Arivazhagan L
Arivazhagan L

Written by Arivazhagan L

Software Engineer | Learner | Follow me to learn more on technologies.