Last active
January 6, 2026 12:43
-
-
Save pythonhacker/ad36c3e6a531d827034d8f4367d96800 to your computer and use it in GitHub Desktop.
Generic list search demo using bisect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >>> l=[10, 12, 15, 17, 18, 20, 20, 21, 21, 21, 24, 24] | |
| >>> search(l, 18) | |
| 4 | |
| >>> search(l, 20) | |
| 5 | |
| >>> search(l, 21) | |
| 7 | |
| >>> search_right(l, 21) | |
| 10 | |
| >>> search_right(l, 24) | |
| 12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment