Results 1 to 2 of 2

Thread: group theory (permutation array)

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    Question group theory (permutation array)

    Hi

    I need to do the school homework about group theory, I need generate all permutation array when the user type n ( n is natural number >0). When The user type for example n=4
    I fill the first row and first column with the sequence {1,2,3,4}, if he typed n= 5 I fill with {1,2,3,4,5}
    Example: for n=4
    * | 1 2 3 4
    ---+----------------------------------------------
    1 | 1 2 3 4 -- First row
    2 | 2 1 4 3
    3 | 3 4 1 2
    4 | 4 3 2 1

    The number in the top and left are number of columns and rows . Look that First row is 1,2,3,4
    and first column is 1,2,3,4
    In the second column and row I have generate all
    permutation possible, but the number only can to be one time in the column and one time in the row. ( the number 1 only one time in the column 1 , one time in the column 2 ...etc).
    Other solution for n=4 is
    * | 1 2 3 4
    ---+----------------------------------------------
    1 | 1 2 3 4
    2 | 2 3 4 1
    3 | 3 4 1 2
    4 | 4 1 2 3

    do somebody to know the algorithm that generate all
    permutation possible without that number show more than one time in the column and row ?
    I search abou derangement algorithm but I do not found.
    I have to do this program in C or C++ or Pascal or Visual Basic

    Thank You in Advance

  2. #2
    Frenzied Member
    Join Date
    Jul 1999
    Location
    Huntingdon Valley, PA 19006
    Posts
    1,151
    To help a friend of mine, I wrote a VB application to generate permutations. It was done in a hurry and lacks some of the features that would go with a finished professional application, but it does a decent job on my system.

    I have zipped all the files, including three Readme files which describe the algorithm and the program. The three Readme files contain the same information. One is an rtf (rich text format) file which can be processed by MS Word, WordPad, and various other Word Processors. One is a wpd (WordPerect) file, and the third is a DOS txt file. The txt file is not color coded, and lacks some formatting which is possible with the other files.

    The Readme files refer to a self-extracting file, but i do not think I can attach such a file to a VB Forum Thread, so I have attached a zip file.

    I run Visual Basic 6.0 in the Visual Studion environment. Try unzipping the files, reading one of the Readme files, and then try to run the application. It is easier to see the algorithm in action than to describe it.
    Attached Files Attached Files
    Live long & prosper.

    The Dinosaur from prehistoric era prior to computers.

    Eschew obfuscation!
    If a billion people believe a foolish idea, it is still a foolish idea!
    VB.net 2010 Express
    64Bit & 32Bit Windows 7 & Windows XP. I run 4 operating systems on a single PC.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width