Author | Message |
---|---|
aalva190
Posts: 64
|
Posted 17:54 Oct 26, 2016 |
I have a problem with even making sure the array that has to be stored in an index. If a set is [1, 1 ,1 , 2, 2, 3] is the new array that is store in the MySet Instance has to be [1,2,3] or only the unique number which is [3]? which of this will be store in the instance of MySet? |
aalva190
Posts: 64
|
Posted 18:01 Oct 26, 2016 |
the Reason i ask is because i read this in the assignment "In other words, if the user creates a MySet object from an array with duplicate values, then your constructor must strip out any duplicates and only keep unique values in the set. " so when i read strip out i taught he said like take out literally. |
jhurley
Posts: 207
|
Posted 18:09 Oct 26, 2016 |
1,2,3 |
nmanimt2
Posts: 8
|
Posted 18:24 Oct 26, 2016 |
does the order of the of the stripped set matter? for example, if i pass an array { 1, 2, 2, 3, 1} does it matter if i get { 2, 3, 1 } rather than { 1, 2, 3} ? |
jhurley
Posts: 207
|
Posted 13:30 Oct 27, 2016 |
the order does not matter. Sets are unordered, so {1,2,3} is equivalent to {2,3,1}. However, you can sort the set in the tests if that helps you determine whether the sets returned by the operations contain the correct elements. |