Join Medium for free to get updates from this writer.
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.
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.
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.
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.
Greedy Algorithm: This pattern involves making the locally optimal choice at each stage with the hope of finding a global optimum.
Backtracking: This pattern involves building a solution incrementally by choosing options that do not violate constraints and undoing choices that do violate the constraint.
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.
Searching: This pattern involves searching through a collection of items to find a specific item or group of items that meet certain criteria.
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.
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.