Quiz
Backtracking
This quiz has question types that open in the usual player.
Questions in this quiz (12)
1If you need to solve a problem and you know how to solve it using a dynamic programming algorithm, but you also know how to solve it using a bakctracking-based algorithm, which one you should usually use?
- ANeither
- BDynamic programming
- CBacktracking
2For the Magic Square problem, with a size of n=3, how many ways to arrange the n^2 numbers are there using brute force?
- A3
- B9
- C362880
- D81
- E27
- Fabout 1000
3Many problems can be represented as abstract graphs. Nodes usually represent valid changes and edges usually represent the state of the problem. Thus, to solve the problem we must find a node or a path in the associated graph
- ATrue
- BFalse
4The implicit graph used for backtracking is usually depicted as a tree, called [blank_start]tree of states[blank_end].
With the technique of backtracking we perform a [blank_start]depth-first[blank_end] search of the tree.
The objective is to find the nodes (states) that are [blank_start]solutions[blank_end] to the problem.
To that end, a exhaustive and systematic [blank_start]search[blank_end] in the solution space of the problem is performed- Atree of states
- Bdepth-first
- Csolutions
- Dsearch
5There are usually two versions of backtracking algorithms. There can be:
- "first solution" if we only need a solution to the problem
- "all the solutions" if we need all the solutions, the best or the worst solution- ATrue
- BFalse
6Indicate which ones can be usually complexities when working with backatracking
- AO(2^n)
- BO(4^n)
- CO(n^2)
- DO(n)
- EO(nlogn)
- FO(n!)
7Which complexity is the worst?
- AO(n!)
- BO(n^n)
- CO(10^n)
8The memory consumption with backtracking depends on the height of the tree of calls and the waste of stack for each recursive call
- ATrue
- BFalse
9With backtracking, the height of the tree of states is usually [blank_start]O(logn)[blank_end] when we have a behaviour by division and [blank_start]O(n)[blank_end] when we have a behaviour by substraction
- AO(logn)
- BO(n!)
- CO(n^n)
- DO(2^n)
- EO(nlogn)
- FO(n^2)
- GO(n)
- HO(1)
10Permutations using backtracking

- Asol[k]
- Bsol[i]
- Ck
- Di
- E(int j=0; j<n; j++)
- F(int i=0; i<n; i++)
- G(int j=0; j<level; j++)
- Hsol[level] = v[j];
- Isol[level] = v[i];
- Jsol[level+1] = v[j];
- Ksol[j] = v[level];
- Lmark[j] = false;
- Mmark[j] = true;
- Nmark[level] = false;
- Omark[level] = true;
11Subsets of a given sum using backtracking

- A(int j=0; j<=1; j++)
- B(int j=0; j<=n; j++)
- C(int j=0; j<=level; j++)
- D(j == 0)
- E(level == 0)
- Fsum = sum + v[level];
- Gsum = v[level];
- Hsum = sum + v[j];
- I(j == 0)
- J(j == 2)
- Ksum = sum - v[level];
- Lsum = sum - 1;
- Msum = sum - v[j];
12Working with backtracking to solve the problem of the n Queens with a board of size n=5, what is the time complexity of the algorithm?
- AO(4!)
- BO(n!)
- CO(2^n)
- DO(n^n)
- EO(5^n)
Information
- Description
- Bachelor of Software Engineering - Algorithmics course - University of Oviedo
- Author
- Vicente García D
- Language
- English
- Views
- 40
- Tags
- Rating
- No ratings yet Rate this quiz