Zorba the Hutt (zorbathut) wrote,
Zorba the Hutt

Is it just me, or is the entire world stupid today?

"How can I count the unique values in a set of 70 million 64-bit numbers?"
"Put them in a vector, sort them, and run unique."
"A map uses too much RAM."
"Yes. That's why you should use a vector."
"But a vector won't tell me how many unique numbers there are!"
"It will if you sort them and run unique."
"Oh. What does unique do?"
"It takes a sorted array and eliminates all the duplicates."
"How does it work?"
"(briefly implements unique)"
"But that looks like it will only work if the array is sorted!"
"Yes. That's why you sort it first."
"Oh. Okay. What do I do after I sort it?"

  • Post a new comment


    default userpic

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.