Table elements compare...

This is a discussion on Table elements compare... within the C++ Programming forums, part of the General Programming Boards category; Hey! I am happy i joined your great community I have a problem, and hope someone can help me. I ...

  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    1

    Table elements compare...

    Hey! I am happy i joined your great community


    I have a problem, and hope someone can help me.

    I have a table NxM dimension - A.

    I have to find in A dominate lines, otherwords - I have to find in A any line that has each element smaller than for ex the elements from [k] line.

    I mean Line [i] is dominated if there is line [k] and for any [j] we have A[i][j]<A[k][j]. When i find dominated lines- i have to delete them from A.

    for ex:
    A=

    1 | 1 5 6 7|
    2 | 2 1 9 0|
    3 | 8 3 1 4|
    4 | 7 1 0 2|

    here line [4] is smaller than line [3],
    line [4] is dominated , and i delete it.

    I need your help in composing an algorithm.
    Going to write it in C++.
    Hope that somebody will propose an algorithm.
    I became mad....can't compose...

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,417
    Well a function to compare rows i and j of a given matrix would be a useful start.

    Like
    bool result = isDominant( A, i, j );

    A function which returns true or false, depending on the rule you've outlined.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing array, to file
    By zootreeves in forum C Programming
    Replies: 9
    Last Post: 09-08-2007, 05:06 PM
  2. progarm doesnt compile
    By kashifk in forum Linux Programming
    Replies: 2
    Last Post: 10-25-2003, 05:54 PM
  3. extra word printing
    By kashifk in forum C++ Programming
    Replies: 2
    Last Post: 10-25-2003, 04:03 PM
  4. inputting words from a file
    By kashifk in forum C++ Programming
    Replies: 5
    Last Post: 10-24-2003, 07:18 AM
  5. help with operator <
    By kashifk in forum C++ Programming
    Replies: 1
    Last Post: 10-21-2003, 03:49 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21