Hi all, I'm working with images. I don't need to visualize them, just batch process them. So I've tried loading them into the Image class but this lazy loads...
Kirk, Here is an example using a byte[] data to create an Image. http://www.exampledepot.com/egs/java.awt.image/Mandelbrot2.html?l=rel That should allow you to...
Kirk, Why don't you use ImageIO to load the images in a BufferedImage? I do lots of image processing without displaying them (the regular way). And I've never...
Gosh, the list is quite lately. Here's a little puzzler that I faced today - for the sake of sparking discussion, any discussion, let's see how the ST-J...
Yeah, it has been quite. How about this, it is time O(N) and memory O(1) but doesn't try and allocate into gaps in the sequence. public class IdGen { static...
It was a fairly ho-hum mornng until a co-workers machine came up with this gem. The SQL Server Agent (MSSQLSERVER) service depends on the SQL Server ...
... Bill must have shown up late to class on the day they were talking about an infinite number of monkeys using an infinite number of typewriters given an...
... That's a clever idea - it didn't even cross my mind to use regex Pattern to detect conflicts in the name. I'm disappointed in the lack of response -...
... Apologies - just been a bit busy lately. I took a quick look at the code, but wasn't able to quickly grok what the problem was all about and had to move...
Matt's is much better. His is O(n), yours is O(n^2). But that only describes one call to generateUniqueID. Now suppose you are doing this in a loop, generating...
Some odd things about this interface are that it's mutable, the baseName is independent of the collection and not preserved within the Element, and there is no...
So, I'm sitting here in my hotel room in London, paying for internet access (!), fighting jetlag and waiting 'till it's a decent hour to go to the pub. Here's...
Is this the tortoise and hare algorithm? Basically, you have the first "checker" move every two nodes and the second checker moves to every node. If they ever...
... If there is a constant time algorithm that solves that problem I'll buy you a beer. It would be worth it to learn the algorithm. :-) -- Esse Quam Videre ...
... That would still seem to be an O(n) algorithm. And it doesn't tell you that the node you started with is in the loop, just that there is one. -- Esse Quam...
... The tortoise/hare approach is O(n) in time, but O(1) in memory, which all Matt was hinting at - you only need to keep track of two nodes. (and the task was...
A little late to the party (I just re-found ST-J after a mail client reorganisation), and making all sorts of assumptions about the longevity/portability of...
... <...> ... It does not surprise me at all, because IME this kind of puzzle has very little to do with producing useful, quality software that meets everyday...
... Given the limited context I provided about the use of this, that is a reasonable response. But given the real context (generating new items in response to...
... It was just a poor specification. I didn't give any context about what it is actually for; but that was intentional on my part - I wanted to leave as much...
... Ah hem. The problem statement was "Write an algorithm that given a Node, determines if that Node is part of a circularly linked list." We need to know of...
Is N known ahead of time? And what does "part of a circularly linked list" mean? A circular list can have leader nodes and loop nodes. If isCircular(start)...
Using the system clock is equivalent to ... only your "n" ticks faster. It assumes that all clocks are in synch, that all ids are assigned using the same...
I think the base should not be part of the ID and you should separate the ID generation/assignment from ID presentation. If the IDs are presented to the user,...
That is such a popular question that they wrote a book about it. It made for an interesting read and as Eric says in a later post knowing how to solve these...