Python

bisect

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

Moduli bisect bën kërkim binar në një listë të renditur: bisect_left() gjen ku duhet futur një vlerë, dhe insort() e fut duke e mbajtur listën të renditur.

EnglishEN

The bisect module does binary search on a sorted list: bisect_left() finds where a value should go, and insort() inserts it keeping the list sorted.

Si ta mendosh

Si ta gjesh fjalën në fjalor duke e hapur në mes.

Lexoje në anglisht

Like finding a word in a dictionary by opening it in the middle.

Shembull kodipython

import bisect
notat = [2, 3, 5, 5, 8]
bisect.insort(notat, 4)
print(notat, bisect.bisect_left(notat, 5))

Terma të lidhur