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

Compare and contrast a response and an adaptation. Use examples from your everyday world in your answer.
How do you write the name of the period that has the digits 913?
What is 7/8, 0.98, and 8/9 in order from least to greatest
I know how to do equivalent fractions but idk how to do this one
You travel 60 kilometers in 1.5 hours. What is your average speed?
3x + y = 19 , and x + 3y = 1. Find the value of 2x + 2y Can anyone explain this one for me?
What is the answer to this problem and how do you solve it -6=b/18
PLEASE HELP I need to make a simple acrostic poem for the word "CHARTER" (the definition is "a document that granted the right to form a colony")
the perimeter of a triangle is 117 cm. two sides are 31 cm and 48 cm. find the third side.
at what levels do biologists study life???