[Pascal]TRI SHELL -Recursion

Last update on August 23, 2009 11:35 AM by jak58
Published by aakai1056

[Pascal]TRI SHELL -Recursion





Tri Shell Recursion


Below is a recursive process that allows sorting n integers using Tri Shell.

Procedure Tri_Shell_Rec (Var t: TAB; n,h : integer);
Var aux,i : integer;
begin If h > 0 Then
    Begin
        If n > h Then
             begin
                  Tri_Shell_Rec (t,n - h,h);
                  If t[n] < t[n - h] Then
                  Begin
                     aux:= t[n];
                     i := n;
                     Repeat                        
                        t[i] := t[i - h];
                        i := i - h;
                     Until (i = h) Or (aux > t[i - h]);
                     t[i] := aux;
                  End;
              End;
        Tri_Shell_Rec (t,n,h Div 3);
    End;
End;<


Note:


It is recommended to test this procedure on small tables as if this is not the case and the number of calls become important and will however cause a spillover the battery. The technique for recursion is the memory.

We can increase the table test size by augmenting the battery size.
Best answers for « TRI SHELL Recursion » in :
[Pascal language] Recursion within a Shell Sort Show [Pascal language] Recursion within a Shell Sort Recursion, in the computing or mathematical terms, is a method of defining functions in which the function being defined is applied within its own designation. The term is also used more...
UNIX system - The shell Show Introduction to the shell The command interpreter is the interface between the user and the operating system, hence its name "shell". The shell therefore acts as an intermediary between the operating system and the user using command lines...
Linux - The shell Show Introduction to the shell The command interpreter is the interface between the user and the operating system, hence the name "shell". The shell therefore acts as an intermediary between the operating system and the user thanks to command lines...
Replacing Variables in Bash/shell ShowReplacing Variables in Bash/shell Intro: Expression:Defininition Intro: First of all make sure that you the variable is defined before replacing it, or in other cases determine that it is not empty, and to initialize with a default...
[Shell]Create a file having a specific size ShowShell]Create a file having a specific size The dd command allows you to create "empty" file of desired size, creating these arbitrary heavy files, may be useful for testing purposes. Use command below: dd if=/dev/zero of=file_to...
Shell script for telnet and run commands ShowShell script for telnet and run commands Issue Solution Note Issue I have made a shell script which can telnet automatically and run commands on the other machine and end the telnet session without any interact from the user, only he...
Download SSH Secure Shell ShowSSH secure shell for workstations is a flexible client SSH allowing to connect in a secured way to remote applications. http://www.commentcamarche.net/faq/images/NHc6wz5jOYBhPXTis.png
Download Vista Live Shell Pack - Pink ShowIf you want to have Vista on your computer but your shape is not rather powerful or if simply you cannot have to be paid this version yet? Then resolution is to change the appearance of your good old XP. Vista Live Shell Pack is a topic of office...
Environment variables ShowEnvironment variables An environment variable is a dynamic value loaded into the memory that can be used by several processes operating simultaneously. On most operating systems, the location of some libraries or of the main system executables may...
UNIX Commands ShowTable of the main UNIX commands Unix Commands Description Options ls lists the content of a directory -a Displays all files, including hidden files -I Displays a...