Camilo Andrés Rodríguez Garzón
Algorithm is a list of marathon challenges this use to Haskell program intends to provide an alternative solution to each of the problems described.
An edit step is a transformation from one word x to another word y such that x and y are words
in the dictionary, and x can be transformed to y by adding, deleting, or changing one letter. So
the transformation from dig to dog or from dog to do are both edit steps. An edit step ladder is a
lexicographically ordered sequence of words w1,w2,...,wn such that the transformation from wi to
wi+1 is an edit step for all i from 1 to n - 1.
For a given dictionary, you are to compute the length of the longest edit step ladder.
A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between
successive elements take on all the values 1 through n - 1. For instance,
1 4 2 3
is a jolly jumper, because the absolutes differences are 3, 2, and 1 respectively. The definition implies
that any sequence of a single integer is a jolly jumper. You are to write a program to determine whether
or not each of a number of sequences is a jolly jumper.
A bishop is a piece used in the game of chess which can only move diagonally from its current position.
Two bishops attack each other if one is on the path of the other. In the figure below, the dark squares
represent the reachable locations for bishop B1 from its current position. Bishops B1 and B2 are in
attacking position, while B1 and B3 are not. Bishops B2 and B3 are also in non-attacking position.
Stan and Ollie play the game of multiplication by multiplying an integer p by one of the numbers 2 to
9. Stan always starts with p = 1, does his multiplication, then Ollie multiplies the number, then Stan
and so on. Before a game starts, they draw an integer 1 < n < 4294967295 and the winner is who first
reaches p ≥ n.
King Yertle wishes to rearrange his turtle throne to place his highest-ranking nobles and closest
advisors nearer to the top. A single operation is available to change the order of the turtles in the
stack: a turtle can crawl out of its position in the stack and climb up over the other turtles to sit on
the top.
Given an original ordering of a turtle stack and a required ordering for the same turtle stack, your
job is to determine a minimal sequence of operations that rearranges the original stack into the required
stack.
A number of students are members of a club that travels annually to exotic locations. Their destinations
in the past have included Indianapolis, Phoenix, Nashville, Philadelphia, San Jose, and Atlanta. This
spring they are planning a trip to Eindhoven.
The group agrees in advance to share expenses equally, but it is not practical to have them share
every expense as it occurs. So individuals in the group pay for particular things, like meals, hotels,
taxi rides, plane tickets, etc. After the trip, each student's expenses are tallied and money is
exchanged so that the net cost to each is the same, to within one cent. In the past, this money exchange
has been tedious and time consuming. Your job is to compute, from a list of expenses, the minimum amount
of money that must change hands in order to equalize (within a cent) all the students' costs.
The classic Triqui game