A Linear-Time Algorithm for a Special Case of