1) temp1 & temp2: initialized
2) Then pair comparation。For instance, a1&an, a2&an-2…ai&an-1 n/2 times
3) when each pair comparation ,if the larger >temp1,->temp1,n/2 times; if the smaller <temp2,->temp2,n/2 times;
so total=3/2n
•
回复:loop n/2 times and 3 comparisons each time
-sub101-
♂
(0 bytes)
()
02/13/2008 postreply
20:17:25
•
see my explaination
-Jamesxu-
♂
(608 bytes)
()
02/14/2008 postreply
03:04:01
•
btw, memory read means memory look up here
-Jamesxu-
♂
(130 bytes)
()
02/14/2008 postreply
04:55:42
•
Right! The average value for the operation of Amei's is also 3n/
-戏雨飞鹰-
♀
(0 bytes)
()
02/14/2008 postreply
07:51:16
WENXUECITY.COM does not represent or guarantee the truthfulness, accuracy, or reliability of any of communications posted by other users.
Copyright ©1998-2025 wenxuecity.com All rights reserved. Privacy Statement & Terms of Use & User Privacy Protection Policy