Sorting

This is a discussion on Sorting within the C++ Programming forums, part of the General Programming Boards category; i have class like this Code: template class<T> class A{ private: T m; T n; List<T> *start; List<T> *end; public: ...

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    5

    Sorting

    i have class like this

    Code:
    template class<T>
    class A{
         private:
                    T m;
                    T n;
                    List<T> *start;
                    List<T> *end;
         public:
                    ...
    }
    and List<T> has x,y,value

    how can i sort this doubly linked list according to x,y values?

  2. #2
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,308
    Perhaps you could post the definition of 'List', and give an example of a type that you would use for T.
    Do you know how to write a less-than operator?
    Why do you not use a std::list, and why are 'start' and 'end' pointers to Lists rather than just straight members?
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting algorithms, worst-case input
    By Leftos in forum C++ Programming
    Replies: 17
    Last Post: 06-15-2009, 01:33 PM
  2. Replies: 26
    Last Post: 06-11-2009, 11:27 AM
  3. Need help with linked list sorting function
    By Jaggid1x in forum C Programming
    Replies: 6
    Last Post: 06-02-2009, 02:14 AM
  4. sorting structure members using pointers
    By robstr12 in forum C Programming
    Replies: 5
    Last Post: 07-25-2005, 05:50 PM
  5. Still Needing Help : selection sorting
    By Unregistered in forum C Programming
    Replies: 6
    Last Post: 10-14-2001, 08:41 PM

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