Click to See Complete Forum and Search --> : Question about a merge method


KingJaymz
March 2nd, 2004, 01:59 PM
I was wondering if it should just be assumed that a merge method as part of a SortedList ADT will sort the merger as well as just add the elements of the new list. Is this a safe assumption? This is the problem:

"26. The Sorted List ADT is to be extended with an operation 'merge', which adds the contents of a list parameter to the current list."

I need to write the method and I'm having a problem with trying to find how to add the elements in a sorted matter. I'm not to call any of SortedList's methods or List's methods, so I don't understand how I could analyze each item, especially since the parameter is not a list. Please help.

cjard
March 5th, 2004, 11:08 AM
It is impossible to mutate a SortedList without calling any of its methods