Message Boards Message Boards

1
|
1510 Views
|
1 Reply
|
1 Total Likes
View groups...
Share
Share this post:

What time complexity are set operations?

Posted 1 year ago

I'm very new to Mathematica and I have a question about time complexity. I see that Mathmatica has sets, and given what I'm up to, I hope that sets have O(log N) insertion and deletion. But I see that sets are represented as ordered lists. If nothing special is going on with the lists, then insertion and deletion are O(N). I'd like to know which it is.

More generally, I'd like to know how to look up the time complexity of Mathematica functions. I didn't set it in the documentation of the set functions.

Thanks

POSTED BY: Mark Massy

The List structure is what many languages would call a vector or an array. So complexity of insertion/deletion is indeed O(n).

POSTED BY: Daniel Lichtblau
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract