Sardinas–Patterson algorithm