patch delete algorihtm