Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this questionthis question (which does not require a prefix free code), but is a good explanation of what is required.

Happy wedding and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they are back from the honeymoon.

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy wedding and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they are back from the honeymoon.

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy wedding and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they are back from the honeymoon.
Notice removed Draw attention by Dr. belisarius
Bounty Ended with wxffles's answer chosen by Dr. belisarius
deleted 67 characters in body; deleted 1 characters in body
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy marriagewedding and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they returnare back from the honeymoon.

Edit 2

A bounty can't be started. Awaiting for a bug fix.

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy marriage and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they return from the honeymoon.

Edit 2

A bounty can't be started. Awaiting for a bug fix.

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy wedding and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they are back from the honeymoon.
Notice added Draw attention by Dr. belisarius
Bounty Started worth 100 reputation by Dr. belisarius
added 174 characters in body
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy marriage and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they return from the honeymoon.

Edit 2

A bounty can't be started. Awaiting for a bug fix.

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy marriage and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they return from the honeymoon.

We all know a conspicuous member of our community got hitched recently. As most of us are not in Malta, and weren't able to fly there, I thought of a celebration question. Sort of.

The challenge is golfing a function (Mma only) that finds a prefix free encoding for the letters of two sentences.

The trick is that both sentences (given as parameters) must share the same encoding, with one of them written backwards.

The number of available symbols for the encoding is also a parameter for the function (always less than 10), and the function should attempt to find the shortest encoding for that number of symbols. There is no a-priori guarantee that a solution exists for every parameter set.

As an example, related to our celebration:

we wish you the best

and

sz is the handsomest groom

Inspiration was taken from this question (which does not require a prefix free code), but is a good explanation of what is required.

Happy marriage and golfing!

Shortest code wins!

PS: A bounty of 100, a wedding garter and the party leftovers to the winner

EDIT Clarifications. To be updated as comments and answers arise

  1. No caps. Only lowercase.
  2. No need to encode whitespaces, special chars or punctuation (skip them and consider only lowercase letters)
  3. Your solution should be able to show up results before they return from the honeymoon.

Edit 2

A bounty can't be started. Awaiting for a bug fix.

Notice removed Draw attention by Sjoerd C. de Vries
Notice added Draw attention by Sjoerd C. de Vries
added 304 characters in body; added 17 characters in body
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456
Loading
Tweeted twitter.com/#!/StackMma/status/229805561317838848
added 162 characters in body; edited body
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456
Loading
deleted 10 characters in body
Source Link
rm -rf
  • 89.3k
  • 21
  • 297
  • 479
Loading
Source Link
Dr. belisarius
  • 116.2k
  • 13
  • 205
  • 456
Loading