Thread: compare structures

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Apprentice
    Join Date
    Oct 2006
    Location
    LA
    Posts
    53
    Ok. I got your point.

    Will this work fine?

    Code:
    list < report_row > ::iterator listIterEnd, listIter;
    
    list<report_row> finalList;
    
    finalList.clear();
    
    objectList1.sort();
    objectList2.sort();
    
    listIterEnd = set_difference(objectList1.begin(), objectList1.end(), objectList2.begin(), objectList2.end(), finalList.begin());
    I assume finalList will contain the unique report rows from objectList1. Another person will write a function and will pass me the 2 lists so I cant test with actual data now.

  2. #2
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "Describe an algorithm that makes a single pass over the first list and at most a single pass over the second list to determine the elements that are present in the first list but not in the second list."

    Easy. Create a third and fourth list and... ^_^;

    Soma

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 07-11-2008, 07:39 AM
  2. Structures within Structures
    By Misko82 in forum C Programming
    Replies: 2
    Last Post: 08-27-2007, 12:25 AM
  3. Classes and Structures.
    By jrahhali in forum C++ Programming
    Replies: 6
    Last Post: 03-28-2004, 05:03 PM
  4. How do I compare structures??
    By aspand in forum C Programming
    Replies: 4
    Last Post: 06-09-2002, 10:47 AM
  5. Methods for Sorting Structures by Element...
    By Sebastiani in forum C Programming
    Replies: 9
    Last Post: 09-14-2001, 12:59 PM