|
|
My question is: how well would this work on an array that has, say, 300 elements? Or 1,000 elements? |
We were asked to come up with a some code to match multiple entries from two arrays, |
so i'm just starting a data structures class, |
|
|
This is more just out of my curiosity, soThis is more just out of my curiosity, so there are no limitations as to what I can use in terms of containers/functions/etc. there are no limitations as to what I can use in terms of containers/functions/etc. |
I guess my question just boils down to how effective this algorithm would be for arrays that contain large amounts of elements. |
|
|
Wouldn't having an element larger than the size of the frequency array cause a segmentation fault? |
So would something like this be more desirable?: |
|
|
|
|
|
|
Actually I was envisioning something like: |
Unfortunately, I don't think that satisfies the constraints of the problem (which were very poorly expressed.) |
Perhaps the OP will chime in and clarify. |
for
loop). Increment the map[n] for every n in the first sequence. (This creates a histogram.)array<...>
was a primitive form of map<int,int>, which works fine and is just as efficient time wise, but much less so in terms of space.