asymptotically faster algorithm