News:

How did you even find this place?

Main Menu

[Java] Enums with specified ordinals

Started by Camel, October 15, 2007, 01:44:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Camel

Quote from: Sidoh on October 15, 2007, 01:56:56 PM
Quote from: Camel on October 15, 2007, 01:04:40 PM
An example of O(log(n)) would be a quicksort, because the number of iterations increases linearly as n increases proportionally. That is to say, each time you double the size of the input array, the run-time increases by a constant amount.

Quicksort is in the average case, in the worse case (which occurs when the list is already sorted).

An example of a algorithm is binary search.

Oops! I edited my post, and forgot to proof read it.

Quote from: Sidoh on October 15, 2007, 01:56:56 PM
I don't know about the original problem, Camel.  I suppose you could do binary search instead of a linear search, if you make sure everything is in ascending order?  That's better than the O(n) you have there.  I guess that's what you were hinting at, though.  It's sort of an ugly problem, because you're going to have to muck something up.  You either do a search, which seems silly, or add a bunch of filler elements, which also seems silly.  I say you tell Java to fix the way enums work. :)

Since the packet IDs are mostly used, I will just fill in the gaps with SID_UNKNOWN_0x??s

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!

while1

Must... refrain... from making a big O joke.
I tend to edit my topics and replies frequently.

http://www.operationsmile.org

Camel

If you must bump old topics, you should at least have something to contribute.

<Camel> i said what what
<Blaze> in the butt
<Camel> you want to do it in my butt?
<Blaze> in my butt
<Camel> let's do it in the butt
<Blaze> Okay!