Join Nostr
2026-10-08 14:07:29 UTC

codementor on Nostr: Question: n = 1,000,000. Code A has a loop over all items, and inside it another loop ...

Question: n = 1,000,000. Code A has a loop over all items, and inside it another loop over all items. Code B calls Array.Sort once, then loops over the items once.

What is the Big-O of each, and which is faster?

Try to answer before you open the reply.

#big004 · BIG-004-Q2