abstract alogrithm