Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

Pages: **1**

**Amartyanil****Member**- From: Universe
- Registered: 2013-05-27
- Posts: 80

Hi;

Is it possible rearrange the words in a string in every possible way. If yes, how to do it?

"Every place is the center of the universe. And every moment is the most important moment. And everything is the meaning of life." ~ Dan Harmon

Offline

Yes, it is definitely possible. You do it using recursion.

First, you try to answer the question, how do you do it if the string is empty. Then, you try to answer how to permute a string of length (n+1) if you knew how to permute a string of length n.

'And fun? If maths is fun, then getting a tooth extraction is fun. A viral infection is fun. Rabies shots are fun.'

'God exists because Mathematics is consistent, and the devil exists because we cannot prove it'

I'm not crazy, my mother had me tested.

Offline

Pages: **1**