Langford's Problem

Let's talk about algorithms!

Moderator: Board moderators

Post Reply
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Langford's Problem

Post by Observer »

In short:
1. The sequence contains 2N integers, where N = 4x or 4x-1 .
2. Each of the integers between 1 and N appears twice in the sequence.
3. The two integers K in the sequence are separated by exactly K other numbers.
e.g. Solution for N = 3 is "3 1 2 1 3 2"

Now, I have to write a Pascal program to generate a single solution for any valid N(3 <= N <= 200). However, my program is extremely slow when N > 64 ... >_<

So, could anyone help me? Thx in advance!
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
New poster
Posts: 21
Joined: Tue Jul 01, 2003 9:26 am
Location: Hong Kong

Post by raymond85 »

I am interested in how people solve this problem too.
My friend told me that an algorithm called local search can be used.
However, I dont know what is local search and no one explained to me. Hope someone can help. Many thanks!
Post Reply

Return to “Algorithms”