angr.utils.algo

angr.utils.algo.binary_insert(lst, elem, key, lo=0, hi=None)

Insert an element into a sorted list, and keep the list sorted.

The major difference from bisect.bisect_left is that this function supports a key method, so user doesn’t have to create the key array for each insertion.

Parameters:
  • lst (list | deque) – The list. Must be pre-ordered.

  • element – An element to insert into the list.

  • key (Callable) – A method to get the key for each element in the list.

  • lo (int) – Lower bound of the search.

  • hi (int | None) – Upper bound of the search.

  • elem (Any)

Return type:

None

Returns:

None