Re: sets and vectors

From: Sheldon Simms (sheldonsimms_at_yahoo.com)
Date: 11/13/03


Date: Thu, 13 Nov 2003 12:50:03 -0500

On Thu, 13 Nov 2003 15:48:50 +0100, L.J. Buitinck wrote:

> Corey Murtagh wrote:
>> Alex P wrote:
>>> Some languages provide structured types besides arrays,
>>> strings and records; for instance, sets and vectors.
>>> What are the advantages of these? What are the
>>> drawbacks? In what languages are they implemented?
>>
>> Pascal provides sets natively from memory. They're likely implemented
>> internally as a bit array, with one bit for each potential item in the
>> set. They get used a lot in Delphi, I know that much. Also implemented
>> in the C++ STL from memory.
>
> isn't that a bitset?

Pascal calls it a "Set", so I guess it's a set.

> a set is a mathematical object holding items, where such items may be
> contained only once in each set.

Which is exactly what Pascal provides, it's just that the only items
that can go into the set are identifiers.



Relevant Pages

  • Re: [Algorithm] Sum of Primes < 1000000
    ... boolean in an array gets its own byte. ... BitSet uses a long, and packs 64 bits into each element, so a million ... elements only take 125,000 bytes of memory. ...
    (comp.lang.java.programmer)
  • Re: [Algorithm] Sum of Primes < 1000000
    ... boolean in an array gets its own byte. ... BitSet uses a long, and packs 64 bits into each element, so a million ... elements only take 125,000 bytes of memory. ...
    (comp.lang.java.programmer)
  • Re: Fast string operations
    ... Looping: I thought looping over arrays in managed code was "slow" ... array handling and such. ... The problem with TrimHelper is that it always returns a new string instance. ... The customer perceives this as a memory leak. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: High Memory Consumption of Classes and Arrays
    ... Only the array itself has overhead. ... memory as a reference type. ... > least consume 40 bytes of memory. ...
    (microsoft.public.dotnet.framework.performance)
  • Re: Fast linked list
    ... > amounts of memory rather than huge chunks of it. ... random insertions into a vector/dynamic array are not as slow ... to cause a cache miss. ... some hard numbers on speed differences between lists and arrays. ...
    (microsoft.public.vc.mfc)