Crash Prediction and Collision Avoidance using Hidden Markov Model