tungwaiyip.info

home

about me

links

my software

Media

Yucatán Photos

St Lucia Photos

Photo Album

Videos

Blog

< July 2010 >
SuMoTuWeThFrSa
     1 2 3
4 5 6 7 8 910
11121314151617
18192021222324
25262728293031

past articles »

Click for San Francisco, California Forecast

San Francisco, USA

 

Find Sophie Solution (Facebook Programming Puzzle)

This is the fourth and probably my last post about solving Facebook programming puzzle. The Find Sophie problem is a buffet (hardest) level puzzle. It is basically a variation of the traveling salesman problem. Traveling salesman is of course, a NP-complete problem. But before you throw up your hand, consider the puzzle refers to locations in your home where you may find a cat. Just how many locations are there. Let's say living room, dining room, bedroom, on the bed, under the desk, behind the curtain, ... etc. If Facebook is not very wicked, this puzzle should be bounded to a low hundreds of locations. This mean it is still possible to solve using some relatively simple search algorithm.

Here is the outline of my solution:

  1. Prepare to enumerate all paths.
  2. Prefer the local optimal during the search. Remember the best solution encountered so far.
  3. Prune the search tree. For example if the current best solution has a score of 50. When you are considering another path, as soon as its score exceed 50, you should abandon it.
  4. Improve the pruning by taking the additional score to complete the path into account. For example, if the current score of a partial path is S, the minimum score to complete the remaining walk is Rmin. Then if S+Rmin > best score, prune it.

Actually I have submitted the solution a few months ago. Only today do I find out I have not posted my solution in my blog. So I'm really speaking from my memory. I hope my plan is still accurate. Again my un-tidied code is available.

The other 3 facebook puzzles I have solved was posted below:

2010.07.22 [] - comments

 

 

blog comments powered by Disqus

past articles »

 

BBC News

 

'Many exposed' to Mali Ebola girl (24 Oct 2014)

 

State of emergency imposed in Sinai (25 Oct 2014)

 

Google boss sets new skydive record (24 Oct 2014)

 

Life terms for Argentina jail crimes (25 Oct 2014)

 

Malaysia envoy appears in NZ court (25 Oct 2014)

 

Russia 'helped Yanukovych to flee' (24 Oct 2014)

 

One killed in US school shooting (25 Oct 2014)

 

Tunis 'militant hideout' stormed (24 Oct 2014)

 

Canada attack 'not linked to IS' (24 Oct 2014)

 

Rwanda bans BBC over genocide film (24 Oct 2014)

more »

 

Slashdot News for nerds, stuff that matters

 

Microsoft Now Makes Money From Surface Line, Q1 Sales Reach Almost Billion (2014-10-25T00:07:00Z)

 

Days After Shooting, Canada Proposes New Restrictions On and Offline (2014-10-24T23:22:00Z)

 

AT&T Locks Apple SIM Cards On New iPads (2014-10-24T22:47:00Z)

 

Passwords: Too Much and Not Enough (2014-10-24T22:08:00Z)

 

Verizon Injects Unique IDs Into HTTP Traffic (2014-10-24T21:26:00Z)

 

Secretive Funding Fuels Ongoing Net Neutrality Astroturfing Controversy (2014-10-24T20:43:00Z)

 

A Low Cost, Open Source Geiger Counter (Video) (2014-10-24T20:01:00Z)

 

Computer Scientist Parachutes From 135,908 Feet, Breaking Record (2014-10-24T19:14:00Z)

more »

 

TechPsychic Tech Rumors and Invented News

more »

 

SF Gate

 

Bay Area News (7 Jan 2012)

 

City Insider (11 Feb 2012)

 

Crime Scene (13 Feb 2012)

 

C.W Newius Column (10 Jan 2012)

 

C.W. Nevius Blog (11 Feb 2012)

 

Education News (10 Jan 2012)

 

KALW (11 Feb 2012)

 

Matier and Ross Blog (11 Feb 2012)

 

Tech companies haven’t gotten past sexism 1.0 (24 Oct 2014)

 

Tech political donors at crossroads as funds pour into campaigns (24 Oct 2014)

 

Workers can save more in 401(k) plans next year (24 Oct 2014)

 

Pandora Media stock falls as growth flattens (24 Oct 2014)

 

Ford goes zero-emissions with a Pedego electric bike (24 Oct 2014)

 

'Silicon Beach’ brings tech boom to Los Angeles (24 Oct 2014)

more »

 

Asia Times Online

 

THE ROVING EYE The Kobani riddle (Fri 24 Oct 2014 11:00:00 GMT)

 

Lords rule Hong Kong's democracy dance (Fri 24 Oct 2014 11:00:00 GMT)

 

The importance of being exceptional (Fri 24 Oct 2014 11:00:00 GMT)

 

The US and selective support for separatism (Fri 24 Oct 2014 11:00:00 GMT)

 

COMMENT Uzbek president faults Soviet system, keeps relics (Fri 24 Oct 2014 11:00:00 GMT)

 

JOHN PILGER Whitlam and Australia's forgotten coup (Thu 23 Oct 2014 11:00:00 GMT)

 

SPEAKING FREELY Ideological dilemma grips Hong Kong (Fri 24 Oct 2014 11:00:00 GMT)

 

Rouble decline hits home in Central Asia (Fri 24 Oct 2014 11:00:00 GMT)

more »

 


Site feed Updated: 2014-Oct-24 21:00