\d? ldZd dddZd dddZd dddZd dddZ ddlTn #e$rYnwxYweZeZdS) zBisection algorithms.Nkeyc|t||||}nt||||||}|||dS)zInsert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the right of the rightmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. Nr) bisect_rightinsertaxlohirs ..\python\lib\bisect.py insort_rightrsS { !QB ' ' !SSVVR 5 5 5HHROOOOOc |dkrtd|t|}|)||kr"||zdz}|||kr|}n|dz}||k"n1||kr+||zdz}||||kr|}n|dz}||k+|S)aReturn the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e <= x, and all e in a[i:] have e > x. So if x already appears in the list, a.insert(i, x) will insert just after the rightmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. rlo must be non-negativeN ValueErrorlenr r r r rmids r rrs Avv2333 z VV {2gg7q.C1S6zz1W 2gg2gg7q.C33qv;;1W 2gg Irc|t||||}nt||||||}|||dS)zInsert item x in list a, and keep it sorted assuming a is sorted. If x is already in a, insert it to the left of the leftmost x. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. Nr) bisect_leftrrs r insort_leftr5sS { Ar2 & & CCFFB 4 4 4HHROOOOOrc |dkrtd|t|}|)||kr"||zdz}|||kr|dz}n|}||k"n1||kr+||zdz}||||kr|dz}n|}||k+|S)aReturn the index where to insert item x in list a, assuming a is sorted. The return value i is such that all e in a[:i] have e < x, and all e in a[i:] have e >= x. So if x already appears in the list, a.insert(i, x) will insert just before the leftmost x already there. Optional args lo (default 0) and hi (default len(a)) bound the slice of a to be searched. rrNrrrrs r rrDs Avv2333 z VV {2gg7q.Cvzz1W 2gg2gg7q.Cs1S6{{Q1W 2gg Ir)*)rN) __doc__rrrr_bisect ImportErrorbisectinsortrr r$s T     TD D     DF    D   s %--