Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #34324

Re: Mathematics, Java, good enough

From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Mathematics, Java, good enough
Date 2016-05-17 10:58 -0400
Organization A noiseless patient Spider
Message-ID <nhfbce$6ii$1@dont-email.me> (permalink)
References (1 earlier) <dq0f7gFnat7U1@mid.individual.net> <nhf2l1$6dn$1@dont-email.me> <nhf7kk$o1p$1@dont-email.me> <768508de-3c08-4d46-8c68-8a5f8b7db533@googlegroups.com> <ff57f7e8-2d3a-4fb0-a9fe-763965a76af3@googlegroups.com>

Show all headers | View raw


On 5/17/2016 10:29 AM, FredK wrote:
> On Tuesday, May 17, 2016 at 7:17:23 AM UTC-7, FredK wrote:
>> The question arises whether you really want to know how many distinguishable strinmgs there are, which is much smaller if the original set contains duplicate entries.
> For example, if the set it "AAB" there are only 3 distinguishable strings of length 2: AA, AB, and BA

     What happened to "BB"?  I think you're writing about a
situation that doesn't match the O.P.'s question.

     The O.P. wrote that he had a "set of characters," and went
on to mention its "cardinality" -- from this, I understood him
to mean that he actually had a "set."  {A A B} is not a set.
(It's a multiset, yes, but not a set.)

	import java.util.HashSet;
	public class TryMe {
	    public static void main(String[] unused) {
	        HashSet<Character> set = new HashSet<>();
	        set.add('A');
	        set.add('A');
	        set.add('B');
	        System.out.println(set.size());
	    }
	}

If the output is "3", your Java is broken.  ;)

-- 
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM

Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Mathematics, Java, good enough Duncan Idaho <duncan@dunenoemail.com> - 2016-05-17 11:49 +0100
  Re: Mathematics, Java, good enough Eric Douglas <e.d.programmer@gmail.com> - 2016-05-17 04:55 -0700
  Re: Mathematics, Java, good enough Nigel Wade <nmw@ion.le.ac.uk> - 2016-05-17 12:56 +0100
    Re: Mathematics, Java, good enough Nigel Wade <nmw@ion.le.ac.uk> - 2016-05-17 13:06 +0100
    Re: Mathematics, Java, good enough Duncan Idaho <duncan@dunenoemail.com> - 2016-05-17 13:29 +0100
      Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 09:54 -0400
        Re: Mathematics, Java, good enough FredK <fred.l.kleinschmidt@gmail.com> - 2016-05-17 07:17 -0700
          Re: Mathematics, Java, good enough FredK <fred.l.kleinschmidt@gmail.com> - 2016-05-17 07:29 -0700
            Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 10:58 -0400
              Re: Mathematics, Java, good enough Duncan Idaho <duncan@dunenoemail.com> - 2016-05-17 18:10 +0100
                Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 14:02 -0400
                Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 14:10 -0400
                Re: Mathematics, Java, good enough Eric Douglas <e.d.programmer@gmail.com> - 2016-05-17 11:36 -0700
                Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 16:12 -0400
                Re: Mathematics, Java, good enough Eric Douglas <e.d.programmer@gmail.com> - 2016-05-17 13:56 -0700
                Re: Mathematics, Java, good enough Gene Wirchenko <genew@telus.net> - 2016-05-17 14:13 -0700
                Re: Mathematics, Java, good enough Duncan Idaho <duncan@dunenoemail.com> - 2016-05-18 05:06 +0100
  Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 08:25 -0400
  Re: Mathematics, Java, good enough Martin Gregorie <martin@address-in-sig.invalid> - 2016-05-17 12:24 +0000
  Re: Mathematics, Java, good enough Duncan Idaho <duncan@dunenoemail.com> - 2016-05-17 18:15 +0100
    Re: Mathematics, Java, good enough Jerry Stuckle <jstucklex@attglobal.net> - 2016-05-17 13:33 -0400
    Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 14:09 -0400
      Re: Mathematics, Java, good enough Gene Wirchenko <genew@telus.net> - 2016-05-17 14:17 -0700
        Re: Mathematics, Java, good enough Eric Sosman <esosman@comcast-dot-net.invalid> - 2016-05-17 17:49 -0400

csiph-web