Design a function in a sequence (part 2)
  • Posted: 7 years ago
  • Updated: 6 years ago
  • Edit
  • answers (1)
  • views (3252)

In Design a function in a sequence (part 1) , can you perform invert() without using last() ?

Posted Answers

We can perform invert() by keeping two temporary sequence without using last() .

/* Two temporary sequence */
S temp1, temp2;
/* using invert() from above */
reverse original sequence into temp1;
reverse temp1 into temp2;
reverse temp2 into original sequence;


You need to Sign In to post your solution.