The weather forecast says…..

…snow overnight and then freezing rain…

Posted in Bloody hell, Too good to miss | 1 Comment

Um…..

Whales0001

Posted in Bad joke alert | Leave a comment

Don’t read this…

IMG_0135

… it could be detrimental to your health.

One of Pythagoras’s students crossed the master (who maintained that ALL square roots are rational) with his life by drowning by proving the opposite.

As he pushed the student’s head under water, he noticed how the displacement of the water raised the level of the tub, cried “Eureka” and that’s how the Archimedes Principle was discovered.

I think.

Assuming that the student’s name was Archimedes….

Posted in Baffling me with science, True stories | Leave a comment

Moon hoax. Not

This is a long one, but worth  13 minutes of your life.

(What else are you going to do, anyway? Watch Celebrity Come Dancing?/Got Talent?/X Factor?)

Posted in Too good to miss | 1 Comment

If, seventy years ago, you asked Henry Luce….

…”What is Time magazine for?” he’d probably talk about setting society’s agenda, capturing the attention of the educated and powerful and most of all, delivering the best weekly news package he could.

Today, the answer is clear. The purpose of the magazine is to make as much money as possible. Everything else is in service of that goal.

The rest of  a very good article is here on Seth Godin’s website

Posted in Things I have learned, Too good to miss | 1 Comment

So, the question is basically

 

From Jason Kottke’s kottke.org

Yesterday I was pairing the socks from the clean laundry, and figured out the way I was doing it is not very efficient. I was doing a naive search — picking one sock and “iterating” the pile in order to find its pair. This requires iterating over n/2 * n/4 = n2/8 socks on average.

As a computer scientist I was thinking what I could do? Sorting (according to size/color/…) of course came into mind to achieve an O(NlogN) solution.

Hashing or other not-in-place solutions are not an option, because I am not able to duplicate my socks (though it could be nice if I could).

So, the question is basically:

Given a pile of n pairs of socks, containing 2n elements (assume each sock has exactly one matching pair), what is the best way to pair them up efficiently with up to logarithmic extra space? (I believe I can remember that amount of info if needed.)

I will appreciate an answer that addresses the following aspects:

  • A general theoretical solution for a huge number of socks.
  • The actual number of socks is not that large, I don’t believe me and my spouse have more than 30 pairs. (And it is fairly easy to distinguish between my socks and hers, can this be utilized as well?)
  • Is it equivalent to the element distinctness problem?

One option:

Suppose that you know that your 2n socks are arranged this way:

p1 p2 p3 … pn pf(1) pf(2) … pf(n)

where f is an unknown permutation of the set {1,2,…,n}. Knowing this cannot make the problem harder. There are n! possible outputs (matchings between first and second half), which means you need log(n!) = Omega(n log n) comparisons. This is obtainable by sorting.

Since you are interested in connections to element distinctness problem: proving the Omega(n log n) bound for element distinctness is harder, because the output is binary yes/no. Here, the output has to be a matching and the number of possible outputs suffices to get a decent bound. However, there’s a variant connected to element distinctness. Suppose you are given 2n socks and wonder if they can be uniquely paired. You can get a reduction from ED by sending (a1, a2, …, an) to (a1, a1, a2, a2, …, an, an). (Parenthetically, the proof of hardness of ED is very interesting, via topology.)

I think that there should be an Omega(n2) bound for the original problem if you allow equality tests only. My intuition is: Consider a graph where you add an edge after a test, and argue that if the graph is not dense the output is not uniquely determined.

Another option

List<Sock> UnSearchedSocks = getAllSocks();
List<Sock> UnMatchedSocks = new list<Sock>();
List<PairOfSocks> PairedSocks = new list<PairOfSocks>();

foreach (Sock newSock in UnsearchedSocks)
{
  Sock MatchedSock = null;
  foreach(Sock UnmatchedSock in UnmatchedSocks)
  {
    if (UnmatchedSock.isPairOf(newSock))
    {
      MatchedSock = UnmatchedSock;
      break;
    }
  }
  if (MatchSock != null)
  {
    PairedSocks.Add(new PairOfSocks(MatchSock, NewSock));
    UnmatchedSocks.remove(MatchedSock);
  }
  else
  {
    UnmatchedSocks.Add(NewSock);
  }
}

The right answer

1) Throw all your socks out.

2) Go to Uniqlo and buy 15 identical pairs of black socks.

3) When you want to wear socks, pick any two out of the drawer.

4) When you notice your socks are wearing out, goto step 1.

Posted in Baffling me with science, Too good to miss | 1 Comment

Tunes for a Tuesday – 22 January 2013

T4TCan You Be A One-Woman Man – Sam Dees – The Chess Story 1947-1975 (1969-1975) [Listen]
Can’t Repeat – The Offspring – Greatest Hits [Listen]
Diaraby Magni – Vieux Farka Toure – Fondo [Listen]
Generator – Gap Dream – BIRP! October 2012 [Listen]
Here Comes Santa Claus – Bob B. Soxx & The Blue Jeans – A Christmas Gift for You From Phil Spector [Listen]
My Buddy – Dr. John – Trippin’ Live [Listen]
Poor Old Dirt Farmer – Levon Helm – Dirt Farmer [Listen]
Wild Situation – Dennis Wilson – Pacific Ocean Blue [Listen]
You Can Call Me Al (Paul Simon cover) – Noah & The Whale – Miscellaneous Covers [Listen]
You See Me – The Band – Jubilation [Listen]

Posted in Mixtape, Music, Tunes for a Tuesday | Tagged , , , , , , , , , , , , , , , , , , , , , , , , , , , , , | Leave a comment

Billy Preston, Dr. John, Joe Walsh, Levon Helm, Rick Danko, Garth Hudson, Nils Lofgren and Clarence Clemons

Oh, and Ringo, too.

The All Starr Band, 1989

Posted in Music, Too good to miss | Leave a comment

“Cool, huh?”

Someone wrote: “There’s a fine line between genius and insanity and I believe Keith erased it some time ago….”

Posted in Music, Too good to miss | Leave a comment

Two old men who can’t sing worth shit

Screen Shot 2013-01-16 at 10.24.00Quite wonderful

[Listen]

Posted in Music, Too good to miss | Leave a comment