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