design and implement an algotihm of aoe