Skip to content

Isn't the time complexity a little high, when for (auto x : m) { ... }? #10

@daidai21

Description

@daidai21

Isn't the time complexity a little high, when for (auto x : m) { ... }? One iteration calls fifo_map_compare n^2 times.

I think the time complexity of such a structure can be lower:

  • one map: {Key, Value is pointer to node of queue}
  • one queue: fifo, node{key, value}

For loop just iterates through the queue.

Looking forward to your reply!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions