make it clear this way:

回答: check more carefullyJamesxu2008-02-13 17:43:09

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- 给 sub101 发送悄悄话 (0 bytes) () 02/13/2008 postreply 20:17:25

see my explaination -Jamesxu- 给 Jamesxu 发送悄悄话 (608 bytes) () 02/14/2008 postreply 03:04:01

btw, memory read means memory look up here -Jamesxu- 给 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

请您先登陆,再发跟帖!