F. The UWS Algorithms
Description
This UWS - called Algorithms - proposes three different kinds of job: Chvatal, Syracuse and Ackerman. They correspond to (famous) algorithms which may take a long time in function of their parameters. Thus you will be able to play with the execution queue management and, in some cases, with the UWS errors (particularly the StackOverflowError with some parameters of Ackerman).
Besides, contrary to the UWS Timers, this UWS has been a little customized:
- This UWS object is actually an extension of QueuedExtendedUWS which lets managing several jobs lists and an execution queue. See A.1. Choosing the "type of UWS" for more details.
- The default home page (a XML document) has been replaced by a redirection toward the form that you are currently reading. See D.1. Name, description and home page for more details.
- A XSLT style sheet has been linked to all XML resources of this UWS. In that way, all XML documents are transformed in HTML by your web-navigator.
- A UWS action has been added to the main resource of this UWS. See D.6. Actions for more details.
- The UWS errors are displayed differently: the default Apache displaying has been replaced. See D.8. Redirections and errors for more details.
Additional UWS Action:
This UWS has an additional action which lets displaying a description and some statistics about this UWS.
Jobs lists
Chvatal
This algorithm must reorder an array of integer. Its values are function of its size: size=4 => {1,2,3,4}, size=7 => {1,2,3,4,5,6,7}, ...
By default, these values are mixed. The algorithm must permute the array[i] first values until array[i] = i+1.
This algorithm is based on the algorithm of V. Chvatal:
This algorithm is based on the algorithm of V. Chvatal:
while(array[1] != 1) // permute the first array[1] values
Syracuse
Implementation of the algorithm of Syracuse also known as the problem of 3x+1. There, is the algorithm:
if (n==1) return 1; else{ if (n%2 == 0) return S(n/2); else return S(3n+1); }
Ackerman
It is a double recursive function whose the algorithm is:
if (m==0) return n+1; else{ if (n==0) return A(m-1, 1); else return A(m-1, A(m, n-1)); }