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


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

Re: Mathematics, Java, good enough

Path csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Eric Sosman <esosman@comcast-dot-net.invalid>
Newsgroups comp.lang.java.programmer
Subject Re: Mathematics, Java, good enough
Date Tue, 17 May 2016 10:58:44 -0400
Organization A noiseless patient Spider
Lines 29
Message-ID <nhfbce$6ii$1@dont-email.me> (permalink)
References <nhesp7$hn7$1@dont-email.me> <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>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Tue, 17 May 2016 14:55:10 -0000 (UTC)
Injection-Info mx02.eternal-september.org; posting-host="2d081e2f7155c28005d4472f67c2f43d"; logging-data="6738"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18Enhuvs+w++31fuME8SQq3"
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0
In-Reply-To <ff57f7e8-2d3a-4fb0-a9fe-763965a76af3@googlegroups.com>
Cancel-Lock sha1:xkQbdynTyg1BFoKt9I3eLUx86tE=
Xref csiph.com comp.lang.java.programmer:34324

Show key headers only | 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