How to efficiently check whether x appears before y in a list
Given a list L
in Python, and two elements x
and y
that are guaranteed to be in L
, I wish to know whether x
appears before y
in L
.
Given a list L
in Python, and two elements x
and y
that are guaranteed to be in L
, I wish to know whether x
appears before y
in L
.