added 'cost' statistic to all algrothims