Skip to content

Commit d25ef90

Browse files
committed
fix: add note on dedupe
1 parent adb4845 commit d25ef90

File tree

1 file changed

+3
-1
lines changed
  • home/4_resource_itineraries/3_CN_Competitive_programming/3._Backtracking

1 file changed

+3
-1
lines changed

home/4_resource_itineraries/3_CN_Competitive_programming/3._Backtracking/0_index.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ Note:
5858
- Storage - Usually, we want to traverse over all possible decisions, instead of storing them. This may mean keeping a max size array (i.e. max candidate size) and doing operations on it as we traverse through the decision
5959
- Efficient - Backtracking means enumeration, but it should be efficient - we should backtrack as soon as we know forward decisions in the current path are doomed to fail, or have already been seen. i.e. *early backtrack and avoid duplicate is important in backtracking*.
6060
- Order of output - Another thing in backtracking is the order of output - so if the answer needs to be in sorted order, we must use recursion instead of bitwise-gen (suppose problem is subset gen), since recursion maintains sorted order by default.
61-
- Handling deduplication: we must make sure each configuration is processed only once (especially if order of decisions does not matter).
61+
- Handling deduplication:
62+
- Requirement: we must make sure each configuration is processed only once (especially if order of decisions does not matter).
63+
- How to do it: by creating a structure that solves dedup automatically. Bottom-up and top-down arent always equivalent, for example.
6264

6365

6466
## Subsets

0 commit comments

Comments
 (0)