multiset unique elements counting

D

dushkin

Hi all.

Is it possible to know (without iterating ofcourse) how many unique
keys are in a multiset?
I know that a set has unique values, but I would prefer using
multiset in my solution if I have the unique keys counting solution.

Example:

Given a multiset with values: {1,1,2,4,5,4,3,1} - The unique counting
will give me 5 for {1,2,3,4,5} keys.

Thanks!
 
D

dushkin

A indirect solution may be adding the multiset items to a set and then
get the set size..
But I wonder if there is a direct way of getting the unique items
number.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top