Generating Permutations and Combinations Using Depth-First Search
Permutations This article demonstrates a method for generating all permutations of a set of numbers using depth-first search (DFS).
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int MAX_SIZE = 100010;
int size, sequence[MAX_SIZE];
bool visited[MAX_SIZE];
void generatePermutations(int ...
Posted on Tue, 04 Aug 2026 17:03:36 +0000 by nominator
Backtracking Algorithms for Combination Problems in LeetCode
Overview of Backtracking
Backtracking is a systematic way to explore all potential solutions by building combinations incrementally and backtracking when a path fails to meet constraints. It's particularly useful for problems like combinations, permutations, subsets, and other combinatorial searches.
Common problem types solved with backtrackin ...
Posted on Sat, 01 Aug 2026 17:00:22 +0000 by saras
Backtracking Algorithm: Fundamentals, Combinations, and Pruning
Backtracking Algorithm
Understanding Backtracking
Backtracking solves problems by exploring all possible solutions in a systematic way, often represented as a tree structure. The algorithm recursively searches through subsets, where the size of the original set determines the tree's width, and the recursion depth determines its height. Since re ...
Posted on Mon, 13 Jul 2026 17:21:59 +0000 by ashbai
Unbounded Knapsack Dynamic Programming: Combinations vs Permutations
Unbounded Knapsack ProblemIn the classic 0/1 Knapsack problem, each item can be selected at most once. The Unbounded Knapsack problem modifies this constraint: each item can be chosen an unlimited number of times. Consider a knapsack with a maximum capacity of 4, and the following items:ItemWeightValueA115B320C430The core difference in implemen ...
Posted on Sun, 17 May 2026 17:18:17 +0000 by bbristow