recategorized by
4,196 views
14 votes
14 votes

A language with string manipulation facilities uses the following operations

head(s): first character of a string
tail(s): all but exclude the first character of a string
concat(s1, s2): s1s2

For the string "$acbc$" what will be the output of

concat(head(s), head(tail(tail(s))))
  1. $ac$
  2. $bc$
  3. $ab$
  4. $cc$
recategorized by

1 Answer

Best answer
25 votes
25 votes

Answer is C.

  • $concat(a,head(tail(tail(acbc))))$
  • $concat(a,head(tail(cbc)))$
  • $concat(a,head(bc))$
  • $concat(a,b)$
  • $ab$.
edited by
Answer:

Related questions

11 votes
11 votes
3 answers
1
35 votes
35 votes
6 answers
3
Kathleen asked Oct 8, 2014
47,620 views
For merging two sorted lists of sizes $m$ and $n$ into a sorted list of size $m+n$, we require comparisons of$O(m)$$O(n)$$O(m+n)$$O(\log m + \log n)$
31 votes
31 votes
6 answers
4
Kathleen asked Oct 8, 2014
18,278 views
The number of $1$'s in the binary representation of $(3\ast4096 + 15\ast256 + 5\ast16 + 3)$ are:$8$$9$$10$$12$