Reverse an input string of length 100 in 60 cycles?
I am very, very amazed.
Fast String Reversal
-
- Posts: 144
- Joined: Fri Mar 28, 2008 11:29 pm
- Location: #hacker.org on Freenode
-
- Posts: 144
- Joined: Fri Mar 28, 2008 11:29 pm
- Location: #hacker.org on Freenode
I did a rewrite of the program using a superior technique and cut 20% more off that time. It may be possible to make it even shorter still using some sort of hybrid/alternative method or other optimizations, but I think I'll stay with what I've got for now...
I'm sure someone will still be able to beat me while I have a suboptimal solution, so until then...!

My first threaded functional version uses 34 cycles ... % is count as a cycle as well 
I have some trick in sleeve ... not working in java version, but getting under 27 ?!
OK, I am on 33 now. And now on 32.
Codding in excell is more convenienet than in notepad ...
I have finished SuperHack debugger in Excell VBA, it helps in debugging, but not producing codding ideas.
(32 works for inputs of length upto 108)
I could probably evolve to 31, but I should make higher changes to reach required 29.
Already on 30
... works for inputs of length upto 112 ... and now till 120 and now 122 ... 124
I had to add several blank lines to my code 
And I have 29 ... upto 96
So finally on 29,117 ... and the input length could be prolonged a bit.
Oops php implementation differs from what I have expected
... back to codding
... no that was just wrongly sent solution...

I have some trick in sleeve ... not working in java version, but getting under 27 ?!
OK, I am on 33 now. And now on 32.
Codding in excell is more convenienet than in notepad ...
I have finished SuperHack debugger in Excell VBA, it helps in debugging, but not producing codding ideas.
(32 works for inputs of length upto 108)
I could probably evolve to 31, but I should make higher changes to reach required 29.
Already on 30



And I have 29 ... upto 96
So finally on 29,117 ... and the input length could be prolonged a bit.
Oops php implementation differs from what I have expected

... no that was just wrongly sent solution...