Why is the brute-force approach less ideal here?
Practice this question from Next Permutation - Pivot and Suffix Reversal Pattern Practice Quiz, with options and an explanation.
Question
Why is the brute-force approach less ideal here?
Option A — Correct answer
Generating all permutations is factorial time.
Option B
It is always O(1)
Option C
It avoids all comparisons
Option D
It only works for binary trees
Explanation
Generating all permutations is factorial time.