Problem statement: Given a list/array of integers, count the number of occurrences of each element and print only those elements which occur once.
For the above problem, I have executed the following code. This works for small size lists of integers. However when the list size goes beyond 99999, the code hangs.
I understand that ArrayList works well for accessing the elements and the time complexity is less. However is it the right collection to be used, when iterating over such a large size data?
What kind of approach we need to take, to come up with an effective solution, while dealing with huge volumes of data? [ In view with deciding the right data structure/collection ]
This was also asked as an interview question a couple of times.
Thank you. This approach works better and could get the unique list in lesser time.
Can you please suggest some links/documentation which can clearly explain what kind of data structure/collection we can choose based on the operation to be performed [ search, sort, count, add, delete ], data size, less execution time and efficient memory management ?
This would help clear some concepts for me.