你的time complexity is as high as 8 O(N), which is even worse than quick sort. Normally we will trade space for speed in algorithms when I did a lot k-d data structure coding before.
我没算错的话,你的space complexity is good, O(N),
所有跟帖:
•
yes, both sub01 and amei has O(0) time complexity
-Jamesxu-
♂
(0 bytes)
()
02/13/2008 postreply
08:25:14
•
sorry, i meant O(n), not O(0) which means constant
-Jamesxu-
♂
(0 bytes)
()
02/13/2008 postreply
08:35:59
•
sorry I made a mistake, ur algorithm is not bad comparing to
-yellowlemon-
♀
(47 bytes)
()
02/13/2008 postreply
08:26:16
•
sort >= O(nlogn)
-Jamesxu-
♂
(0 bytes)
()
02/13/2008 postreply
08:28:12
•
yes, right. long time did not pick up algorithms book coz
-yellowlemon-
♀
(91 bytes)
()
02/13/2008 postreply
08:30:24