How do I find all possible positions?

If I have 3 positions and 3 numbers I know there are 6 possible soultions (of having a diff number in each)
If I have 4 positions and 4 numbers I know there are 12 possible soultions (of having a diff number in each)
I know the function to find the number of diff positions in n! where n is the number of positions ( + is the ! called shreek?)
5! = 5 * 4 * 3 * 2 * 1 = 120 diff positions
But how do I find out what all the different positions are (ie to print out a list)
I just can't work out how to write an algorithm for this.
Maybe there is somwwhere on the web I can find out, but Google won't let me search for ! + I don't know the real name for it.

I dashed this off. I can't read the one posted above without my eyes bleeding. This one uses recursion.
import java.util.*;
public class Test
    public static void main(String[] args)
        for (int[] array : permutations(5)) print(array);
    static void print(int[] array)
        for (int i = 0; i < array.length; i++) {
            System.out.print(array);
System.out.print(' ');
System.out.println();
static List<int[]> permutations(int number)
int[] input = new int[number];
for (int i = 1; i <= number; i++) input[i - 1] = i;
return permutations(input, 0);
static List<int[]> permutations(int[] input, int from)
List<int[]> bigPerm = new ArrayList<int[]>();
for (int i = from; i < input.length; i++) {
int[] next = new int[input.length];
System.arraycopy(input, 0, next, 0, from);
next[from] = input[i];
for (int j = from + 1; j < input.length; j++) {
next[j] = input[(j <= i) ? j - 1 : j];
if (from < input.length - 1) {
bigPerm.addAll(permutations(next, from + 1));
} else {
bigPerm.add(next);
return bigPerm;

Similar Messages

  • How do I find all the purchased items on my iPhone? When I try to update the iPhone iOS while connected to my MacBook it says there are purchased items on the phone that have not been transferred to my iTunes library and that I should transfer them.

    How do I find all the purchased items on my iPhone? When I try to update the iPhone iOS while connected to my MacBook it says there are purchased items on the phone that have not been transferred to my iTunes library and that I should transfer them before updating.

    Thanks. This seems to have worked easily.

  • How can I find all exclamation marks in my iTunes without clicking on each song?  Is there a way to delete all instead of one at a time?

    How can I find all exclamation marks in my iTunes without clicking on each song?  Can they be deleted all at once instead of one song at a time?

    Lost & Found
    Create a playlist called Found, select everything in Music and drag it into the Found playlist (it may take some time to count the tracks that are to be dropped). Create a smart playlist called Lost matching All the rules Playlist is Music and Playlist is not Found. Your lost tracks will be in this playlist.
    Optional: It depends a bit on why things aren't where iTunes expects to find them but if they are in sensible Artist & Album folders in some common location then my FindTracks script should be able to reconnect them to iTunes. FindTracks uses some fuzzy matching routines and searches for multiple potential locations. For more details see this thread. Once you have repaired the tracks that can be found you can drag the contents of the Lost playlist into Found which will update things.
    Or, you can simply delete all the tracks in the Lost playlist with Ctrl-A to select them and then Shift-Delete to delete.
    tt2

  • How can i find all included pictures which are not in a album? (only in the Library)

    How can i find all included pictures which are not in a album? (only in the Library)

    Hi there,
    I'm afraid I don't quite understand your question. All images are in your Library and only those you specifically select from that Library would be in an Album. What platform are you using? Revel Mac, Elements, web browser, etc?
    Here is a link with some helpful information:
    FAQ: File Basics: How do I Upload, Download, Share, and Delete files in Revel?
    Thank you,
    Glenyse

  • How do I find all messages sent by a particular sender

    How do I find all messages sent by a particular sender

    Use the Quick Filter bar to find all messages in a folder.
    https://support.mozilla.org/en-US/kb/quick-filter-toolbar
    Use Global Search to find all messages across different folders and accounts.
    https://support.mozilla.org/en-US/kb/global-search

  • How can i find all included pictures in the Online-Library which are not in a album?

    Hi
    I use Adobe Photoshop Elements 13 with (Revel). My question ist how can i find all included pictures in the Online-Library which are not in a album? I would like only to have pictures in Library which are included in a online album.

    Hi there,
    I'm afraid I don't quite understand your question. All images are in your Library and only those you specifically select from that Library would be in an Album. What platform are you using? Revel Mac, Elements, web browser, etc?
    Here is a link with some helpful information:
    FAQ: File Basics: How do I Upload, Download, Share, and Delete files in Revel?
    Thank you,
    Glenyse

  • How can I find all of my past discussions and replies

    Hello
    how i can find all of my past discussions and replies in apple support community ?
    <Subject Edited by Host>

    Click the link below.
    alirezaapple

  • How can we find all the available  user-exits in sap without using SMOD?.

    How can we find all the available  user-exits in sap without using SMOD?.

    Hi,
    Please check this links for user exits list.
    http://www.planetsap.com/Userexit_List.htm
    http://www.easymarketplace.de/userexit.php
    http://www.sap-img.com/ab038.htm
    Regards,
    Ferry Lianto

  • How do I find all of the photos that do NOT contain a specific person tag?

    I am scanning my old photos and slides and organizing them with Photoshop Elements 12.   I have recently started taging the pictures with family names.   I see from this forum that I can search for untagged pictures but how can I find all the pictures that do NOT contain the "Smith" family tag but might contain the "Jones" family tag?  Some pictures will be marked with more than one family name.  The "Find by Details" option defaults to "includes" for keywords and people.  There is no way to set it to "not includes".
    I am running PSE12 on Windows 7 Professional on a Dell XPS desktop.
    Thanks for any suggestions.
    Don K.

    See the online help:
    http://helpx.adobe.com/elements-organizer/using/finding-media-files-keyword-tags.html#excl ude_media_files_from_a_search
    The workaround is often to create a temporary tag for pictures not having a given keyword. Even with a very big catalog, tagging nearly all images is astonishly quick. You select based on the keyword, then use the option to show 'non matching' items, and assign them another (negative) keyword.

  • How I can find all my drivers.

    I install windows 7 on my 15-p238tx. How I can find all my drivers.

    Hi: You should be able to use all of the W7 x64 drivers and software (Don't use any of the BIOS and firmware files) from this model on yours. http://h22207.www2.hp.com/us-en/drivers/selfservice/hp-pavilion-15-p000-notebook-pc-series/6936226/model/7174371 To install the graphics on your model you need to: 1. Install the Intel chipset installation utility and reboot. 2. Install the Intel HD graphics driver and reboot. 3. Install the nVidia HD graphics driver and reboot.

  • TS1702 how do i find all passwords i have used with my apple id

    how do i find all passwords that i have used for my apple id

    Other than remembering them, you can't.

  • How do I find all pictures with no (empty) keyword ?

    I have decided to import all my pictures into LightRoom.
    A lot of my older pictures are not registered with any keywords :(
    - only with IPTC location information.
    My plan is to systematic go through all my pictures and add relevant keywords to all pictures - so my old pictures become as searchable as my newest pictures.
    Some of my old pictures has keywords some has not.
    How do I in Lightroom - find all pictures with no keywords?
    I have tried to use the Find tool - but don't see any options to search for "Empty/missing" keywords.
    Also I would like to find all pictures with few keywords and in step II add additional keywords to these pictures.
    Any ideas on how to make a find all pictures where number of keywords is less than X inside or outside LightRoom.
    Henrik Bach
    Denmark

    > I also did think of the SQL idea.
    > If I find a way of doing this I will repost my findings.
    Well, being a tech geek, I found this challenge kind of irresistible,
    and I'm happy to report I have a solution for you.
    STEP 1
    First, make a copy of your "Lightroom Database.lrdb" file (we'll work
    off the copy to be safe)
    STEP 2
    Next, you need to be able to browse the database. The database is in
    SQLite3 format. I tried installiing an SQLite3 ODBC driver and accessing
    it through MS Access 2003. While Access was able to see all of the
    tables in the database, every time I tried to link to one I got:
    "Reserved error (-7748); there is no message for this error"
    I found a few tips for this but wasn't able to work around it and get it
    to work. Which is a shame, since Access would be the easiest way for
    browsing and querying tables.
    Instead I found an open source tool called SQLite Database Browser.
    http://sourceforge.net/project/showfiles.php?group_id=87946&package_id=91778&release_id=41 4746
    I used the Windows version. There appears to be a version for MacOSX on
    PowerPC. It doesn't look like there is a version for Intel based Macs
    (though if you know how, you could always try downloading the source and
    compiling it yourself).
    STEP 3
    After you install the browser, open it up, choose "Open Database" and
    select the COPY of the lightroom database we made in step 1
    STEP 4
    go to the Execute SQL tab and issue the following command
    SELECT A.idx_filename, count(C.name)
    FROM Adobe_imageFiles A, AGLibraryTagImage B, AGLibraryTag C
    WHERE A.image=B.image AND B.tag=C.id_local AND C.kindName='AgKeywordTagKind'
    GROUP BY A.idx_filename
    HAVING count(C.name) <= 3
    That will give you all images with 3 or fewer keywords applied.
    Of course, theres no guarantee that this wont break in future versions.
    Now an explanation of the data.
    Adobe_imageFiles - contains data about image files:
    1) idx_filename is the filename
    2) absolutePath is the full file path
    3) image is a unique ID for the image which you can cross reference in
    other image related tables
    AGLibraryTag - contains info about "tags" applied to images:
    1) id_local is a unique ID for this "tag", which you can use to cross
    reference in other tag tables
    2) kindName is the kind of tag you are looking at. Available values
    appear to be:
    AgCaptionTagKind
    AgCollectionTagKind
    AgCopyrightTagKind
    AgEnumeratedMetadataTagKind
    AgFolderTagKind
    AgImportTagKind
    AgKeywordTagKind
    AgMissingFileTagKind
    AgQuickCollectionTagKind
    AgSpecialContentOwningTagKind
    AgTempImagesTagKind
    3) name is the value for that tag (the collection name, the keyword, etc)
    AGLibraryTagImage - Use this to connect the images and tags tables

  • How can I find all documents encrypted by a certain application?

    I don't think Spotlight can help with this, so I am trying to use the ordinary Command-F(ind).
    I know there's a parameter option "Created by [application]" but that doesn't work, even though the Info window shows the Kind as this application.
    The specifics:
    Under System 9, I encrypted a lot of files (personal correspondence, mainly) using Sentinel 2.2. In other words, I used Sentinel to require a password to open those files.
    Now I can't open them, because that program doesn't work with Sys X.
    I could open them in Sys 9 and then resave them without the encryption. But I need to find them all.
    (I want to handle them all now, rather than over the next few decades when one might pop up now and then. I won't have Sys 9 forever.)
    I can't find any perameter option to use (in Find) that will locate these files. I have a suspicion that maybe the reason searching on the creator application doesn't work is because Sentinel didn't technically create the documents, it only encrypted existing documents—although in the Info window, Sentinel is shown as the Kind. If it's any help, also shown in the Info window is the version: "Sentinel 2.2, © 1987-89 Supermac Technology."
    Sentinel put it's own icon on all the locked files.
    Seems like it should be easy to do a search to find all these files, but I can't figure out how.
    Any suggestions?
    Thanks.
    Larry

    You should be able to do it, but first you'll need to get a unique piece of metadata for the files, and then you'll need to use the Raw Query format in the Find window. I have a handy little utility written by a cyber-friend I keep in the Dock for getting the metadata entries for a file, and I think there are other free ones on VersionTracker, but you can also use Terminal to get the relevant entries. Thus I have some old Excel files. To locate all of them, I would do this:
    1. Open Terminal (it is in your Utilities folder) and type
    mdls
    and a space. Then drag and drop one of your files into the Terminal window and hit the Return key. The result will look something like this:
    NoobiX:~ francine$ mdls /Volumes/Data/BackUp/8600drives/FastMac/Documents/Finances/Finances1995
    /Volumes/Data/BackUp/8600drives/FastMac/Documents/Finances/Finances1995
    kMDItemAttributeChangeDate = 2007-08-01 12:15:22 -0700
    kMDItemContentCreationDate = 1996-03-13 01:27:46 -0800
    kMDItemContentModificationDate = 1996-03-13 02:08:03 -0800
    kMDItemContentType = "com.microsoft.excel.xls"
    kMDItemContentTypeTree = ("com.microsoft.excel.xls", "public.data", "public.item")
    kMDItemDisplayName = "Finances1995"
    kMDItemFSContentChangeDate = 1996-03-13 02:08:03 -0800
    kMDItemFSCreationDate = 1996-03-13 01:27:46 -0800
    kMDItemFSCreatorCode = 1480803660
    kMDItemFSFinderFlags = 256
    kMDItemFSInvisible = 0
    kMDItemFSIsExtensionHidden = 0
    kMDItemFSLabel = 0
    kMDItemFSName = "Finances1995"
    kMDItemFSNodeCount = 0
    kMDItemFSOwnerGroupID = 501
    kMDItemFSOwnerUserID = 501
    kMDItemFSSize = 6954
    kMDItemFSTypeCode = 1481397044
    kMDItemID = 58528
    kMDItemKind = "Microsoft Excel 4.0 worksheet"
    kMDItemLastUsedDate = 2007-08-01 12:15:22 -0700
    kMDItemUsedDates = (1996-03-13 02:08:03 -0800, 2007-07-31 17:00:00 -0700)
    2. Since I want to find all the old Excel files, I chose the line
    kMDItemKind = "Microsoft Excel 4.0 worksheet"
    You can just drag to select that line with the Mouse, then select copy.
    3. In the Find window criterion drop down menu, select Other, then scroll down to Raw Query, select it, and then paste the kMDItemKind line you copied into the open field. That should do it.
    Francine
    Francine
    Schwieder

  • How do I find all tracks in library that are not in my playlists?

    What's the very best way to find all tracks in your library that are not in your playlists? I only use playlists to show the tracks that i use.. unfortunately I have many extra unwanted tracks buried in my library now because I did not know you could option+delete to delete library tracks from a playlist.

    doofmaczemy wrote:
    oh dear.. it makes a TEXT FILE?
    I guess if it put them in a playlist then they'd be in a playlist so shouldn't be in the playlist... Ow my head hurts!
    How about this as an idea? Create a new top level playlist folder, call it *All Playlists*, then move all your existing folders & playlists inside this folder. Create a new top level smart playlist ( outside of *All Playlists* ) with the rules:
    Playlist is Music AND
    Playlist is not All Playlists
    Call it *Unlisted Temp*
    Create a new top level regular playlist called Unlisted, select all the tracks in *Unlisted Temp* and drag them into Unlisted. You can now delete *Unlisted Temp*, move all your folders & playlists back to their original places and delete the *All Playlists* folder.
    tt2

  • How can I find the previous position for my iPhone?

    It's more then 24 hours since I lost my iPhone, and it seems like it's turned off/don't have more battery left. Is there any possible way to find the previous position of it, when it's more then 24 hours ago?? Please help me, desperate to find my phone, and to know where it was last seen would help me alot.

    Welcome to the Apple Community.
    Unless your phone connects to a cellular or wifi network while still using your iCloud account, it won't show it's location in Find my phone.

Maybe you are looking for

  • Runtime Error in execution of 'SO_OBJECT_SEND' function module

    Hi friends, We are going for upgradation from 4.6c to ECC6.0. There is one program which is used to send external mails thru 'SO_OBJECT_SEND', but the function module is giving runtime error(line no:515) in ECC6. what could be the reason? rewarded, S

  • Adding Portlet at Runtime to the Portal, displaying Empty Error Message Box

    Hi All, I had developed a Webcenter Portal Application, in which i had included runtime editing capabilities for pages and customization at user level - deployed successfully in PS5 Server. I also made another simple Portlet Producer Application - de

  • Tabular Model Partition

    Hi everyone Please help me, I am new to the tabular model  My table data size big having millions of records , i need to apply the Partition on my tables month wise or Year wise. I have search many blogs but i could not able to find the right solutio

  • Field length restriction

    Hi Experts, I am uploading some customer witht the help of BAPI  BAPI_BUPA_FS_CREATE_FROM_DATA2. While uploadig the customer , I am getting a Warning message  " The use of last 5 character in field NAME1 is restricted (>35 to 40) " Message type 'W' ,

  • Mirroring iTunes for sound/music archive?

    Hi, I'm currently working in a postproduction company for a German News Television station. We have recently changed to Final Cut. We'd like to us iTunes for our music archive and this is where the problem starts: Basically we'd like to be able to ha