Decide best suitable data structure | Sololearn: Learn to code for FREE!
0

Decide best suitable data structure

I have a student ID and from id, need to have student details from student object There are less than 50 students and we need to access student object details so many times using id Which data structure is best suitable for this requirement : 1. Set 2. Map 3. List 4. Unordered map List according to me is not good choice as it does not have random access. As we need id and object i.e. key and value , discarding option of set as well What's best between map and unordered map ? I decided to go with map as nlogn is not bad at all rather than having chance of collision for unordered map .. what is preferred and why ?

29th May 2022, 4:36 AM
Ketan Lalcheta
Ketan Lalcheta - avatar
1 Resposta
0
Oh ok...any specific reason to choose bst ? Map is also using bst itself
29th May 2022, 11:27 AM
Ketan Lalcheta
Ketan Lalcheta - avatar