Skip to content

Latest commit

 

History

History
26 lines (22 loc) · 850 Bytes

OZ Arrays.md

File metadata and controls

26 lines (22 loc) · 850 Bytes

160 - OZ Arrays

OpenZeppelin Arrays: Collection of functions related to array types:

findUpperBound(uint256[] array, uint256 element)uint256: Searches a sorted array and returns the first index that contains a value greater or equal to element.

If no such index exists (i.e. all values in the array are strictly less than element), the array length is returned.

Time complexity O(log n) array is expected to be sorted in ascending order, and to contain no repeated elements.


Slide Screenshot

160.jpg


Slide Text

  • Array-related Functions
  • findUpperBound()
  • Params: Array & Element
  • Array: Sorted Ascending
  • No Repeats
  • Value >= Element -> Index
  • None -> Length

References


Tags