Tag Info

New answers tagged

0

Your main question is whether you could have a collision, but it's first important to determine where you might have a collision. An ArrayList does not have collisions because it is an ordered list on top of an array. Your concern there would be more about how often it has to extend the capacity of the underlying array. You would feel this when you are ...


0

It is a bit more complicated than that. The worst-case complexity is O(M * N), and the best-case complexity is O(N). There are two worst-case scenarios: when every subset contains the toPrint String, or when the subsets contain strings that all has to the same value. (The second one is extremely unlikely, unless someone deliberately populates the data ...


0

For hashing operations like the contains() you have above, the worst case complexity is big O of n. This happens when there are n instances with the same hash value and the hashing implementation is chaining. This also happens when n instances have the same hash-value sequence and the implementation is open-addressing. Both of these cases are unlikely, but ...


1

LinkedHashSet, for the intents and purposes of being accessed using contains is simply a hash set. It uses the return from hashCode of the objects inserted in it to determine the position to place it in in the hash set. If you have a collision, then it will then check the next element. If that is occupied, it will then check the one after that, and so ...


4

How complex software is is a matter of opinion. What I see as straightforward someone else may decide is overcomplicated. Having large numbers of identical entities (for example lots of users in a system, lots of questions/answers/comments/photos etc) doesn't tend to add complexity (beyond the obvious difficulties of searching/organising the data). In my ...



Top 50 recent answers are included