|
And of course:
"I feel sorry for people who don't drink. When they wake up in the morning, that's as good as they're going to feel all day." --- Frank Sinatra
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
I was sure that was Dean Martin!
|
|
|
|
|
It gets attributed to Sinatra, Martin, and even Bill Cosby!
But most of the Google links I looked at say MafiaBoy himself, so that's what I went with.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
Fair enough!
|
|
|
|
|
A few hundred more - http://www.goodreads.com/quotes/tag/drinking[^]
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
תפסיק לספר לה' כמה הצרות שלך גדולות, תספר לצרות שלך כמה ה' גדול!
Skipper: We'll fix it.
Alex: Fix it? How you gonna fix this?
Skipper: Grit, spit and a whole lotta duct tape.
|
|
|
|
|
Don't forget:
To alcohol! The cause of, and solution to, all of life's problems.
- Homer
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
A drink problem?
I drink, I fall over - no problem!
Life is like a s**t sandwich; the more bread you have, the less s**t you eat.
|
|
|
|
|
Thanks for the BBQ & meeting your family & friends yesterday, I hope that 50L keg is still going (was a very nice drop)- or at least if that's gone you've got the Bundy Rum
'twas an elephanting good time
cheers
|
|
|
|
|
No problem, but it isn't my birthday until January and I don't recall seeing you at the BBQ yesterday. Are you the one that took off with my keg?
|
|
|
|
|
unless you've changed your name to Michael 'Mick' Martin ... and that'd get you killed, stealing a man's keg, so no ....
|
|
|
|
|
Karel Čapek wrote: No problem, but it isn't my birthday until January and I don't recall seeing you at the BBQ yesterday. Are you the one that took off with my keg?
If you remember back to when you were mark merrens you were shortened to mm. I have always geen MM as I capitalise my name.
Plus I don't reckon January in the US would be very goo Barbecue weather.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Michael Martin wrote: Plus I don't reckon January in the US would be very goo Barbecue weather.
It is where I reside. Last year it was bloody hot here all the way through winter.
Happy f***ing birthday.
|
|
|
|
|
Garth J Lancaster wrote: Thanks for the BBQ & meeting your family & friends yesterday, I hope that 50L keg is still going (was a very nice drop)- or at least if that's gone you've got the Bundy Rum
'twas an elephanting good time
cheers
Thanks very much Garth. Just finishing off a long breakfast of Rump Steak, Fried Rice and Pasta all left over from yesterday.
We only cooked up the 4kg of Rump Steak, 3kg of Sausages and a bit over 1kg of Italian Sausages.
That means for today I have not quite 1kg of Italian Sausages, 6kg of Lamb Grillers, 8 Chicken Breats and 2kg of Mince Beef. Not sure I can get through that.
Michael Martin
Australia
"I controlled my laughter and simple said "No,I am very busy,so I can't write any code for you". The moment they heard this all the smiling face turned into a sad looking face and one of them farted. So I had to leave the place as soon as possible."
- Mr.Prakash One Fine Saturday. 24/04/2004
|
|
|
|
|
Sometimes it sounds like a sh*tty decision to live on the other side of the world.
Can't get Bundy over here. The rest sounded pretty good too.
Anyways, have a good year.
Wrong is evil and must be defeated. - Jeff Ello
Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.
|
|
|
|
|
In the most efficient way finding the lowest common ancestor (LCA) in a hierarchical (or tree) structure using the adjacency list model.
The adjacency list model simply means that every node has an ID and a ParentID that is pointing to the ID of the ParentNode.
The topmost nodes have null as a parent id.
The calculation/algorithm should take a list or array or similar of nodes as a parameter. (Not be limited to two nodes)
Use language of your own choice.
Wrong is evil and must be defeated. - Jeff Ello
Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.
|
|
|
|
|
No.
It's Saturday you slave driver!
|
|
|
|
|
I forgot to post it yesterday.
Wrong is evil and must be defeated. - Jeff Ello
Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.
|
|
|
|
|
Can I assume that there will be more queries so that preprocessing makes sense?
|
|
|
|
|
Didn't think of that. So for the sake of the challenge no.
But good solutions where you think forward, past the stated task, will always get plus points from me.
Wrong is evil and must be defeated. - Jeff Ello
Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.
|
|
|
|
|
It seems a bit boring without preprocessing, that essentially bans all the cool algorithms. At least so far as I know.
With O(n) preprocessing, there's an O(m) algorithm for the LCA of m nodes.
|
|
|
|
|
Huh? What? I just woke up from a nap (18:00 here), I can't think right now.
|
|
|
|
|
Interesting problem. Do we assume that the collection of Nodes to be evaluated do have a common root-level ancestor ? So, if any two Nodes in the evaluated collection do not share the same root, then there is no GCA ?
Does each Node have a collection of pointers to its "child" Nodes ?
«The greater the social and cultural distances between people, the more magical the light can spring from their contact» Milan Kundera, "Testaments Trahis"
|
|
|
|
|
"The topmost nodes have null as a parent id." Note the plural on nodes. So your assumption is correct.
BillWoodruff wrote: Does each Node have a collection of pointers to its "child" Nodes ?
No, just a parent node, but if you want to add a ChildNodes property as a part of your solution, I'm interested to see that too. But assume that the nodes are stored in a database without childnodes and that you can't add them there, so adding them afterwards will affect total performance of the solution.
Wrong is evil and must be defeated. - Jeff Ello
Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.
|
|
|
|
|
Jörgen Andersson wrote: if you want to add a ChildNodes property as a part of your solution, I'm interested to see that too
As the records are read from the database, a pair of Dictionary<id,List<id>> indices can be built -- one to hold ancestors, one to hold descendants. Not sure what to do with them yet, but the two ancestor Lists could be compared fairly easily.
Provided the Lists are ordered with the root first, then compare the Lists until you find the first difference, the previous ancestor is the one you want. Similarly, the Intersection of the sets of ancestors is all the common ancesters.
(It's now midnight and I've been actively working on this for an hour so so far.)
modified 16-Nov-14 19:37pm.
|
|
|
|
|
My idea was to use linked lists.
First create a dictionary for caching the nodes.
Create a linked list for every node in the ParameterCollection, check if the parentnode exists in the dictionary otherwise create it, and AddFirst() to the LinkedList. This way you get it sorted in the right direction.
Then create a collection of enumerators for these LinkedLists and enumerate them until they don't point to the same object anymore. The last common object is the LCA.
An other way is to do it already in SQL, but that's a bit quirkier. I made a tip on that subject a couple of years ago
Wrong is evil and must be defeated. - Jeff Ello
Any organization is like a tree full of monkeys. The monkeys on top look down and see a tree full of smiling faces. The monkeys on the bottom look up and see nothing but assholes.
|
|
|
|