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

10 POINTS PLEASE HELP
Please help me out with this
Describe the basic molecular structures AND primary functions of the four major categories of biological macromolecules: a. Carbohydrates b. Lipids c. Pro
Select the correct answer. Rectangle ABCD is dilated by a scale factor of 2 with the origin as the center of dilation, resulting in the image A′B′C′D′. If the s
natural selection is also known as what​
Imagine that a strong foreign navy had blocked the ports near Rome. What would have likely been the biggest concern to the people of Rome? A. The city of Rome
how do I factor this​
please help me in finding the area​
What is the slope of the line that passes through the points (1,7),(10, 1)?3/22/3-3/2-2/3​
r varies inversely with x . if r= -2 when x=6 what is the value of r when x= -3?