"""
Description: For a specified sequence, use the following algorithm if you need to obtain a sequence that contains only the sequences that are not duplicates:
"""
Seq=[' A ', ' a ', ' B ', ' C ', ' C ', ' d ']
Res=[]
For El in SEQ:
If El not in res:
Res.append (EL)
Print Res
Or
In the Res list, use in to find, its highest complex height will be 0 (n), and then call it in the global loop, and its complexity is also 0 (n), so the complexity is usually 2 square.
Using the Set () type for such an operation is faster because it uses a hash such as dict to find the stored value, that is, the time it takes to query whether it is in set will be a constant:
as follows: Set (SEQ)
Note: When trying the complexity of an algorithm, the data structure should be carefully considered, there are many built-in types, to choose the right one, before invoking the algorithm, the transformation of the database is often more than based on the original data modification algorithm to make it faster and better!
Python uses a collection instead of a list