Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

c#

Name: Anonymous 2010-06-01 21:26

Anyone got a suggestion for a efficient way to store a bunch of numbers (bytes), with the key being a byte? Using C#

Name: Anonymous 2010-06-01 21:28

byte[] arr--oh wait IHBT

Name: Anonymous 2010-06-01 21:30

lol i had to look up IHBT... no I mean, store a variable number of bytes, and have a key byte to retrieve said list, and being able to easily add numbers to the lists.

should i just use a hashtable containing lists?

Name: Anonymous 2010-06-01 21:37

List<byte>[] numbers = new List<byte>[256];
No point in resorting to hashtables if you can have O(1) lookup with a negligible memory overhead.

Name: Anonymous 2010-06-01 21:42

Thanks, I think I'll do it that way.

Name: Anonymous 2010-06-01 21:47

>>4
Erm, that is a hashtable. The hashing function is identity, but still.

Name: Anonymous 2010-06-01 21:53

>>6
I meant an actual Hashtable() :p
this is why I love communicating with other programmers

Name: Anonymous 2010-06-01 22:26

>>7
HashTable() also has O(1) lookup, cuntbag. Keep your emoticons to yourself.

Name: Anonymous 2010-06-01 22:41

So I guess in C# char is a Unicode character and not a byte?

Name: >>4 2010-06-01 22:43

>>6
Derp. I guess I confused a hashtable with some sort of an associative array with a more complex lookup process. I don't actually know how a .NET Dictionary is implemented, but I always thought that it involved a tree.

>>8
I never realized that .NET has a Hashtable class; but I believe that it doesn't really have O(1) lookup.

Name: Anonymous 2010-06-01 22:56

>>10
Well, a tree would be a better implementation strategy in the long run, but that fulfills all the qualities necessary of a hashtable.

Name: Anonymous 2010-06-01 23:52

>>10
It does, test it yourself, mate.

Name: Anonymous 2010-06-02 0:00

>>10
I don't know or care if Seshup has a hash table class, but any child knows hash tables have O(1) lookup. That's the point.

Name: Anonymous 2010-06-02 3:12

>>1

OK nigger, don't use a fucking Hashtable. You want Dictionary<byte, List<byte>>

Dictionary implements a hashtable for lookups. Hashtable is for fags because it boxes and unboxes everything as object, which will add conciderable overhead for your fucking bytes (this isn't Java you faggot [even Java generics box and unbox everything as object because it was made by idiots]).

            var fagtionary = new Dictionary<byte, List<byte>>();
            fagtionary.Add(255, new List<byte>() { 1, 2, 3, 4, 5 });
            fagtionary[255].Add(6);
            Console.WriteLine(fagtionary[255][fagtionary[255].Count - 1].ToString());

Outputs: 6

>>9

For fucks sake nigger. char is not a byte, if it was they would call it byte and not char. A char is 2 bytes.

Name: Anonymous 2010-06-02 4:36

>>13
I'd very much like to see a hash table that has O(1) lookup when using (λ (x) 1) as a hash function.

Name: Anonymous 2010-06-02 7:02

>>15
We're not doing yuor homework.

Name: Anonymous 2010-06-02 8:15

>>15
It would work perfectly fine, but it would only ever store one value.

Name: Anonymous 2010-06-02 9:51

>>14
A char is kind of a byte.

Name: Anonymous 2010-12-17 1:31

Are you GAY?
Are you a NIGGER?
Are you a GAY NIGGER?

If you answered "Yes" to all of the above questions, then GNAA (GAY NIGGER ASSOCIATION OF AMERICA) might be exactly what you've been looking for!

Name: Anonymous 2011-02-03 7:49


Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List