The reason I started the weird side discussion about whether doing this in-place was sensible, is that in Java there is no guarantee of O(1) indexed access on the List interface, if you want that you need to find a list which also implements RandomAccess. So where I said 'I would be surprised in IList required O(1) read and update.', consider me surprised.
icklemichael
@icklemichael
Best posts made by icklemichael
Latest posts made by icklemichael
-
RE: Interview Code Snippet
-
RE: Interview Code Snippet
Now, maybe I am going crazy, but we are not talking about arrays here, we are talking about lists. If you think doing a quicksort on a linked list in place is a good idea then I think you need to get an algorithm's book.
-
RE: Interview Code Snippet
The complexity of the algorithm depends entirely on the implementation of the list, if it is basically an array then it is O(n), if it is basically a linked list then it is O(n^2).
Copy to array, reverse, copy, is always O(n), although if the original supports random access then you're actually going to be slower. :)
-
RE: Interview Code Snippet
I don't do .net, but isn't an in place sort a really bad idea in general? I would be surprised in IList required O(1) read and update.
-
RE: From the "we didn't think that URL through" department
Q. What's worse than a baby in a bag?
A. A baby in two bags!
-
RE: At least it's encapsulated
I think it says:
The only context you ever hear the phrase 'log and throw' is in sentences like 'Never log and throw as you'll get the same message logged 6 times, obscuring the root cause of the problem and generally irritate everyone who uses your code'.
I was somewhat surprised to find that one of my colleagues wrote a method called logAndThrow, the naming implied he was familiar with this anti-pattern and it's problems, yet decided to go ahead and implement it anyway.
Our code is littered with Hashtables and Vectors.
My boss is a dog.
When I don't catch exceptions I get blamed.
-
RE: Community Server 2.1 Testing
Hard to know what's supposed to be working but searching for 'proof' across the entire site isn't throwing up any matches, when there's one occurrence quite visible in the side bar...
-
RE: Community Server 2.1 Testing
The rss feed is broken... I don't know if that is be expected...
-
RE: Web forms & your address
I think you're replying to me.
Hint: I'm not American.
And no I'm not saying that.
Let's look again:
It's very US-centric though. When you're building a site which can be
used by pretty much anyone in the world, dealing correctly with US zip
codes, UK post codes, French whatever, etc would just turn into a
maintenance nightmare.
What I meant to say was that calculating anything from the ZIP/Post
code
would be a right pain in the arse given there are multiple countries in
this world. And that even if you got it right you would never be able
to maintain such a system.
I don't think what I actually wrote was too far from that.
I don't think I'm close to 'saying that insisting on "city" and "state" boxes makes things less US-centric'. As I didn't even mention city or states.
I do have a "postcode" and a "county"
You'd think I would have noticed that when I mentioned UK post codes.
I'm sorry if the British education system (which I presume you share)
either didn't teach me to write or didn't teach you to read.
It's a shame it didn't teach either of us politeness. :)