+ 1

what list should i use the most?

if i just need to make a list of things... what list should i use? HashSet? ArrayList? LinkedList? or what? and is there a List that can store any variable(String, integer, char) in one big list? (like a set in python...)

19th Jun 2020, 1:11 PM
Yahel
Yahel - avatar
3 Answers
+ 2
It depends on what you are planing to do the most with your list. If you want faster access then array is preferred , if you are performing search operation a lot of time then hashset is recommended. If you want it to be flexible in size then linked list is recommended.
19th Jun 2020, 1:20 PM
Arsenic
Arsenic - avatar
+ 2
yahel you can store any type of variable in any type of list in C++ also, but it is required to specify the data type before. And If you are looking for something like set in python then there is similar data structure namely *set* defined in STL .
19th Jun 2020, 1:32 PM
Arsenic
Arsenic - avatar
+ 1
Arsenic, Thanks. what about the second quastion? (and is there a List that can store any variable(String, integer, char) in one big list? (like a set in python...))
19th Jun 2020, 1:25 PM
Yahel
Yahel - avatar