Someone with deep IT background please help -
Implement an efficient algorithm to reverse a string using java (ie, string "nice to see you!" becomes "you! see to nice"). I did it with StringBuilder and tested it with a string containing as many as 3 million words; it wasn't fast.
请教一ALGORITHM问题
所有跟帖:
•
回复:请教一ALGORITHM问题
-svm-
♂
(29 bytes)
()
03/03/2009 postreply
23:03:26
•
I forget about java, but the algorithm seems not hard.
-乱弹-
♂
(394 bytes)
()
03/03/2009 postreply
23:14:21
•
嗯,就是你说的算法
-svm-
♂
(39 bytes)
()
03/03/2009 postreply
23:19:12
•
you may think it's silly, it's fast
-interested1-
♀
(141 bytes)
()
03/04/2009 postreply
21:56:38
•
回复:I forget about java, but the algorithm seems not hard.
-sub101-
♂
(48 bytes)
()
03/04/2009 postreply
06:25:19
•
回复:请教一ALGORITHM问题
-sub101-
♂
(74 bytes)
()
03/04/2009 postreply
06:23:58
•
This definitely works, but uses too much memory. I
-乱弹-
♂
(140 bytes)
()
03/04/2009 postreply
06:47:32
•
回复:This definitely works, but uses too much memory. I
-sub101-
♂
(197 bytes)
()
03/04/2009 postreply
08:01:07
•
My solution: O(n) running time
-TuLaLa-
♀
(446 bytes)
()
03/04/2009 postreply
16:04:52
•
space O(1), speed O(n)
-ncpga-
♂
(75 bytes)
()
03/05/2009 postreply
09:30:49