Non-efficient algorithm tested