edited by
392 views
0 0 votes

You are given a sequence of letters $x_{1}, x_{2} \dots x_{n}$ where each $x_{i} \in \left \{ a, b, c, d, e, f, g, h \right \}$. You can form a new sequence from the given sequence as follows. Start with $x_{1}$. Place $x_{m+1}$ either to the left or to the right of the sequence already built from $x_{1}, x_{2} \dots x_{m}$.

For instance, from $dcbeb$ you can form $ecdbb$ through the steps $d \rightarrow cd \rightarrow cdb\rightarrow ecdb\rightarrow ecdbb$ and $bbcde$ through the steps $d \rightarrow cd \rightarrow bcd\rightarrow bcde\rightarrow bbcde$.

What is the largest sequence in lexicographic (dictionary) order that you can form from the input sequence $becgdfg?$

  1. $ggebcdf$

  2. $ggfedcb$

  3. $ggecbdf$

  4. $ggfebcd$

Please log in or register to answer this question.

Position:
Show:

Related questions

0 0 votes
0 0 answers
329
329 views
admin asked Jul 22, 2022
329 views
Consider the function $\textsf{foo}$ and $\textsf{bar}$ described in pseudocode below, where $/ /$ denotes quotient (integer division) and $\%$ denotes remainder.int foo ...
1 1 vote
1 1 answer
433
433 views
admin asked Jul 22, 2022
433 views
If the milkman doesn’t deliver milk or the geyser doesn’t work, then Akash will be late for school and lunch will be cooked late. Suppose lunch was actually cooked on tim...
0 0 votes
0 0 answers
301
301 views
admin asked Jul 22, 2022
301 views
Let $\text{L}$ be the language over $\left \{ a, b \right \}$ that contains the same number of occurrences of $a$ and $b$. Which of the following languages is regular?$\t...
0 0 votes
0 0 answers
293
293 views
admin asked Jul 22, 2022
293 views
Which of the following regular expressions represents binary strings that are multiples of $3?$ Note that we consider the leftmost bit to be the most significant.$((11)0^...