diff options
Diffstat (limited to 'universe/data_structures_and_algorithms/string-reverse.py')
-rw-r--r-- | universe/data_structures_and_algorithms/string-reverse.py | 22 |
1 files changed, 0 insertions, 22 deletions
diff --git a/universe/data_structures_and_algorithms/string-reverse.py b/universe/data_structures_and_algorithms/string-reverse.py deleted file mode 100644 index 8b4cdac1c271..000000000000 --- a/universe/data_structures_and_algorithms/string-reverse.py +++ /dev/null @@ -1,22 +0,0 @@ - -# swap :: Int -> Int -> [Char] -> IO () -def swap(ia, iz, xs): - # handle swap when ia == iz - assert ia <= iz - xs[ia], xs[iz] = xs[iz], xs[ia] - - -# reverse :: [Char] -> IO () -def reverse(xs): - ia = 0 - iz = len(xs) - 1 - - while ia <= iz: - swap(ia, iz, xs) - ia += 1 - iz -= 1 - -x = list("superduperpooper") -reverse(x) -print(x) -print("Tests pass") |