Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

The same exampled worked through:

  • @a = ( 10, 20, 33, 45, 60 );
  • @b = ( 2, 5, 10, 12, 16, 23, 45 );

    Eliminate common elements:

  • @a = ( 20, 33, 60 );
  • @b = ( 2, 5, 12, 16, 23 );

    Cancel 2 with 20 to give 1 and 10 (discard the 1):

  • @a = ( <strike>20</strike><ins>10</ins>, 33, 60 );
  • @b = ( <strike>2</strike><ins>1</ins>, 5, 12, 16, 23 );

    Cancel 5 with 10 to give 1 and 2:

  • @a = ( <strike>10</strike><ins>2</ins>, 33, 60 );
  • @b = ( <strike>5</strike><ins>1</ins>, 12, 16, 23 );

    Cancel 2 with 12 to give 1 and 6 (discard the 1 )

  • @a = ( 2, 33, 60 );
  • @b = ( 12, 16, 23 );

    Cancel 6 with 60 to give 1 and 10 (discard the 1 )

  • @a = ( 33, 60 );
  • @b = ( 6, 16, 23 );

    Cancel 16 with 10 to give 8 and 5

  • @a = ( 33, 10 );
  • @b = ( 16, 23 );

    Result: (Other reductions are possible!)

  • @a = ( 33, 5 );
  • @b = ( 8, 23 );

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco. -- Rule 1 has a caveat! -- Who broke the cabal?
    "Science is about questioning the status quo. Questioning authority".
    The "good enough" maybe good enough for the now, and perfection maybe unobtainable, but that should not preclude us from striving for perfection, when time, circumstance or desire allow.

    In reply to Re: Algorithm for cancelling common factors between two lists of multiplicands by BrowserUk
    in thread Algorithm for cancelling common factors between two lists of multiplicands by BrowserUk

    Title:
    Use:  <p> text here (a paragraph) </p>
    and:  <code> code here </code>
    to format your post; it's "PerlMonks-approved HTML":



    • Are you posting in the right place? Check out Where do I post X? to know for sure.
    • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
      <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
    • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
    • Want more info? How to link or How to display code and escape characters are good places to start.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2024-04-21 21:26 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found