Logo
Pattern

Discover published sets by community

Explore tens of thousands of sets crafted by our community.

Recursion and Backtracking

8

Flashcards

0/8

Still learning
StarStarStarStar

Branch and Bound

StarStarStarStar

An algorithmic technique similar to backtracking, but with the addition of a bounding function to estimate the utility of continuing down a certain branch. It is used to optimize a search strategy by only exploring branches that are potentially optimal. Example: The Travelling Salesman Problem, seeking the shortest possible route that visits each city once and returns to the origin city.

StarStarStarStar

Dynamic Programming

StarStarStarStar

A method for solving complex problems by breaking them down into a collection of simpler subproblems, solving each of those subproblems just once, and storing their solutions. Example: The Knapsack problem, where we decide whether to include each item in the knapsack such that the total weight is within the limit and the total value is maximized.

StarStarStarStar

Tail Recursion

StarStarStarStar

A special case of recursion where the recursive call is the last operation in the function. In some programming languages, this can be optimized by the compiler so that it does not add a new frame to the call stack. Example: Iterative version of factorial function implemented using tail recursion.

StarStarStarStar

Backtracking

StarStarStarStar

An algorithmic technique for solving problems recursively by trying to build a solution incrementally, one piece at a time, and removing those solutions that fail to satisfy the constraints of the problem at any point of time. Example: N-Queens problem, finding the placement where no two queens attack each other.

StarStarStarStar

Memoization

StarStarStarStar

An optimization technique used primarily to speed up computer programs by storing the results of expensive function calls and returning the cached result when the same inputs occur again. Example: Memoizing the Fibonacci sequence calculation, where the result of each Fibonacci number is stored after it's computed for the first time.

StarStarStarStar

Recursion

StarStarStarStar

A programming technique where a function calls itself in order to divide a problem into smaller, more manageable sub-problems. It is typically used in problems like calculating factorials or Fibonacci numbers. Example: factorial(n) { if (n <= 1) return 1; else return n * factorial(n - 1); }

StarStarStarStar

Divide and Conquer

StarStarStarStar

A paradigm for designing recursive algorithms which involves three steps at each level of the recursion: dividing the problem into smaller subproblems, solving the subproblems recursively, and then combining the solutions of subproblems. Example: Merge Sort algorithm, where the array is divided into halves until single elements remain, and then these elements are merged back together in sorted order.

StarStarStarStar

Greedy Algorithm

StarStarStarStar

An algorithmic paradigm that builds up a solution piece by piece, always choosing the next piece that offers the most obvious and immediate benefit. It is used when a problem exhibits the property of 'greediness'. Example: Coin Change problem, where it selects the largest possible denomination of coins first.

Know
0
Still learning
Click to flip
Know
0
Logo

© Hypatia.Tech. 2024 All rights reserved.