algorithm
Checking if all elements in a list are unique
What is the best way (best as in the conventional way) of checking whether all elements in a list are unique?
heapq with custom compare predicate
I am trying to build a heap with a custom sort predicate. Since the values going into it are of ‘user-defined’ type, I cannot modify their built-in comparison predicate.
Best way to determine if a sequence is in another sequence?
This is a generalization of the “string contains substring” problem to (more) arbitrary types.
How to trace the path in a Breadth-First Search?
How do you trace the path of a Breadth-First Search, such that in the following example:
Representing and solving a maze given an image
What is the best way to represent and solve a maze given an image?
When splitting an empty string in Python, why does split() return an empty list while split(‘n’) returns [”]?
I am using split('n') to get lines in one string, and found that ''.split() returns an empty list, [], while ''.split('n') returns ['']. Is there any specific reason for such a difference?
Mapping a range of values to another
I am looking for ideas on how to translate one range values to another in Python. I am working on hardware project and am reading data from a sensor that can return a range of values, I am then using that data to drive an actuator that requires a different range of values.
Rotate image and crop out black borders
My application: I am trying to rotate an image (using OpenCV and Python)
String similarity metrics in Python
I want to find string similarity between two strings. en.wikipedia has examples of some of them. code.google has a Python implementation of Levenshtein distance.
Is there a better algorithm, (and hopefully a Python library), under these constraints: