Which of the following algorithms will run in constant time?(1 point)

Responses

binary search on a sorted array
binary search on a sorted array

traversing an array
traversing an array

accessing an element of an array
accessing an element of an array

sorting an array

1 answer

The algorithm that will run in constant time from the provided options is:

accessing an element of an array.

Accessing an element in an array by its index takes the same amount of time regardless of the size of the array, hence it is considered O(1) or constant time.

The other options (binary search, traversing an array, and sorting an array) all have varying time complexities that depend on the size of the input.