Home >Backend Development >Python Tutorial >An interesting python sorting module: bisect
Today, a colleague talked about a python sorting module bisect. I thought it was quite interesting and wanted to share it with you.构 First look at the structure of the module:
First look at the insort function:
out out out of the bisect function: E Then look at the bisect_left_rict_richt function. This function will be inserted into the duplicate value, and the position will be inserted:
its corresponding insertion function is insort_Left and insort_richt:
visible to see visible , simply looking at the results, the operation results of the two functions are the same, but in fact the insertion positions are different.