added shrage algorithm working implementation