Time complexity for java ArrayList -
What is the O (n)
or O (1)
?
Java has an ArrayList
a list
Which is supported by any array
. get (index)
method is an ongoing time, O (1)
, operation
public e-mail (int index) {range check (index ); Return (E) element data [index]; }
Actually, it returns a value directly from the backing array ( Renjak (index)
) is also a static time)
Comments
Post a Comment