Problem
This function returns the first item in an array.
def first_item(arr):
return arr[0]
Solution
Input Size | Loops |
---|---|
1 | 1 |
2 | 1 |
3 | 1 |
4 | 1 |
5 | 1 |
How does the runtime increase w.r.t. input size?
It does not.
What is the time complexity?
: indexing an array is a constant time operation.
This workbook was created by Jad and Rayan Slim. Feel free to explore some of their courses:
The Complete Java Development Bootcamp
The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
Feedback Summary
0.0
0 students
5
0%
4
0%
3
0%
2
0%
1
0%
Written Reviews
There are no written reviews yet.