Palindrome detection: Difference between revisions
→{{header|Python}}: added explanation of Twiddle Indexing
m (→{{header|Quackery}}: reformatted) |
(→{{header|Python}}: added explanation of Twiddle Indexing) |
||
Line 4,462:
I have no idea what this technique is called, so I'm going with "Twiddle Indexing".
<pre> Twiddle Indexing v. Negative Indexing
0 1 2 3 4 <-- index
[ a, b, c, d, e ]
~4 ~3 ~2 ~1 ~0 <-- twiddle index
0 1 2 3 4 <-- index
[ a, b, c, d, e ]
-5 -4 -3 -3 -1 <-- negative index</pre>
<lang Python>def palindromic(str):
|