sub01's calculation might takes long cpu circle

if current > max max = current
else if current
worst the CPU instruction cost, 2 compare, 1 assignment
most case: 1 compare 1 assignment or 2 compare

sub01, your solution involves too many plus (which cost same as compare/assignment), multiplier(more expensive than compare), assignment

so I think amei's solution is more optimized.

所有跟帖: 

回复:multiply by 2 is same as bit shift -sub101- 给 sub101 发送悄悄话 (73 bytes) () 02/13/2008 postreply 08:48:02

回复:sub01's calculation might takes long cpu circle -DCD- 给 DCD 发送悄悄话 (78 bytes) () 02/13/2008 postreply 09:04:19

回复:回复:it doesn't work! -sub101- 给 sub101 发送悄悄话 (85 bytes) () 02/13/2008 postreply 09:09:04

回复:it doesn't work! - Yes mistake- thx -DCD- 给 DCD 发送悄悄话 (274 bytes) () 02/13/2008 postreply 09:37:47

请您先登陆,再发跟帖!