rosemcclain8534 rosemcclain8534
  • 21-09-2019
  • Computers and Technology
contestada

What is the time complexity of the contains operation and the find operation for both implementations?

Respuesta :

ExieFansler ExieFansler
  • 26-09-2019

Answer:

Contains O(n)  and find O(n).

Explanation:

Both methods are used in Java .The time complexity of both contains and find methods is O(n).This is because both of them work like a linear search works both the methods they traverse the list or the array elements one by one to look for the element.So iterating over each element gives the time complexity of O(n).

Answer Link

Otras preguntas

Draw 2 lines in a triangle. Make 2 triangles and 2 trapezoids.
Why is the kingdom Protista considered a catch all kingdom?
Measurement is the use of numbers according to a standard. True or False
A rocket lifted off from a launch pad and traveled vertically 30 km, then traveled 40 km at 30 degrees from the vertical, and then traveled 100 km at 45 degrees
Draw 2 lines in a triangle. Make 2 triangles and 2 trapezoids.
Why is the kingdom Protista considered a catch all kingdom?
A rocket lifted off from a launch pad and traveled vertically 30 km, then traveled 40 km at 30 degrees from the vertical, and then traveled 100 km at 45 degrees
Measurement is the use of numbers according to a standard. True or False
container is 5 meters wide ,6meters long and 3 meters in depth what is the capacity in quarts
Write the answer to each problem in terms of the variable.1)chandler is y years old. What expression represent his age 4 yr ago? 11 yr from now?2)claire has y d