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: How would one attempt to create an algorithm for this?

  1. #1
    Junior Member
    Join Date
    Mar 2013
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How would one attempt to create an algorithm for this?

    Say you have a grid with a compound. (size differs)

    Let's just say our compound is HOH.


    ***OHH***
    *H******H
    ****HH***
    ****O****

    Clearly in this grid there are two HOH compounds considering the explanation below.

    In this grid how would create an algorithm to find the combinations of HOH compound.

    Combinations exist if they are neighbors in the grid, above, below, to the left or to the right. Atoms that are only neighbors diagonally do not count.

    So these are examples of compounds.

    **HH**
    **O***

    **H***
    **O***
    **H***

    This is not a compound.

    *HH***
    ***O**


    How would you attempt to do this?


  2. #2
    Member
    Join Date
    Sep 2012
    Posts
    128
    Thanks
    1
    Thanked 14 Times in 14 Posts

    Default Re: How would one attempt to create an algorithm for this?

    Are they neighbours if they aren't directly above? I don't see the two compounds in the 1st example.

  3. #3
    Junior Member
    Join Date
    Mar 2013
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How would one attempt to create an algorithm for this?

    Quote Originally Posted by Starstreak View Post
    Are they neighbours if they aren't directly above? I don't see the two compounds in the 1st example.
    They are neighbours if they aren't directly above. They can be either above below to the right or to the left..

Similar Threads

  1. How would I create this solution algorithm using pseudocode? Im stuck..
    By meghere in forum What's Wrong With My Code?
    Replies: 3
    Last Post: February 14th, 2013, 01:52 AM
  2. How would I create this solution algorithm using pseudocode?
    By meghere in forum Algorithms & Recursion
    Replies: 1
    Last Post: February 13th, 2013, 10:43 PM
  3. Brand New/First Attempt
    By kevinco in forum What's Wrong With My Code?
    Replies: 3
    Last Post: August 14th, 2011, 09:45 PM
  4. Java dialog box is blank in 2nd attempt while using timer.
    By mocherla81 in forum AWT / Java Swing
    Replies: 1
    Last Post: January 17th, 2011, 09:49 AM
  5. [SOLVED] Algorithm Help
    By aussiemcgr in forum Java Theory & Questions
    Replies: 2
    Last Post: September 10th, 2010, 05:12 PM