Markov Chains, Computer Science, Programming, Probability, Problem Solving.
remaining_states[max_prob_index] max_prob = remaining_probs[max_prob_index] max_prob = sum_other_probs*max_prob max_prob_val = max_prob_val*max_prob_val if max_prob >= max_prob_val: return selected else: remaining_states.pop(max_prob_index) remaining_probs.pop(max_prob_index) return