O
O
origami10242019-11-14 17:05:15
JavaScript
origami1024, 2019-11-14 17:05:15

What is the algorithmic complexity of converting an array to a set, via Set(array)?

I solve problems, it is not clear how to take into account the complexity of converting array to set.
According to the idea, Set() loops through all the elements, that is, it adds O (n).
Or does it somehow work directly with memory?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
longclaps, 2019-11-14
@origami1024

Direct, curved - what does this have to do with algorithmic complexity?
O(n).

S
Sergey Tikhonov, 2019-11-14
@tumbler

The question is in which operations to consider the complexity.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question