I have tried desperately to find the answer via Google and failed. I am about to do the benchmark myself but thought that maybe someone here knows the answer a or at least a reference where this is documented.
To expand on my question: suppose I have a list L in R of length N, where N is rather large (say, 10000, 100.000, 1 million or more).
Assume my list has names for every element. `
I wonder how long does it take to retrieve a single named entry, i.e, to do
L[[ "any_random_name" ]]
Is this time O(N), i.e. proportional to the length of the list, or is it O(1), that is, constant independent of the name of the list. or is it maybe O( log N ) ?
complexity for list is O(n) and for set it is O(1) which is constant.
The time complexity of A* depends on the heuristic. In the worst case of an unbounded search space, the number of nodes expanded is exponential in the depth of the solution (the shortest path) d: O(bd), where b is the branching factor (the average number of successors per state).
The worst case for name lookup is O(n). Take a look here: https://www.refsmmat.com/posts/2016-09-12-r-lists.html .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With