Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: All permutations of 2 coordinate int array

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default All permutations of 2 coordinate int array

    I have a set of 2D arrays, structured as so: int[][] cage = new int[someLength][4]. Each array has a set column length of 4; the first two columns are all that concern us with this problem. They are used to define the row and height respectively of a point (e.g. 2,4).

    What I need is to generate all possible permutations of the points using both row and column coordinates from the 2D array. I found a working method to generate all permutations for 1D array of ints here: http://stackoverflow.com/questions/2...tegers-in-java, under update 2 of the first answer.

    Here is an example of a possible input and corresponding output desired:
    In: (1,0)
        (1,1)
     
    Out:(1,0),(1,1)
        (1,1),(1,0)
    Ideally the result will be stored in a 2D array of ints. Thanks in advance.
    Last edited by zach181818; April 12th, 2014 at 07:09 PM.


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    21,894
    Thanks
    55
    Thanked 2,350 Times in 2,321 Posts

    Default Re: All permutations of 2 coordinate int array

    Do you have any specific questions?

    What have you tried?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    6,090
    My Mood
    Mellow
    Thanks
    244
    Thanked 752 Times in 738 Posts

    Default Re: All permutations of 2 coordinate int array

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

Similar Threads

  1. occurrence of int in array..
    By architmathur in forum What's Wrong With My Code?
    Replies: 8
    Last Post: February 28th, 2014, 03:15 PM
  2. coordinate double -> pixel int
    By Tchoumo in forum AWT / Java Swing
    Replies: 7
    Last Post: October 12th, 2013, 05:15 PM
  3. Help generating random permutations from array list
    By mactank13 in forum What's Wrong With My Code?
    Replies: 12
    Last Post: December 2nd, 2012, 09:04 PM
  4. chr array to int
    By Joy123 in forum Java Theory & Questions
    Replies: 5
    Last Post: June 7th, 2011, 07:51 AM
  5. Object array to int array?
    By rsala004 in forum Collections and Generics
    Replies: 1
    Last Post: October 30th, 2009, 05:09 AM

Tags for this Thread