difference b/w data structures

Aug 17, 2014 at 7:00am
Is there any difference b/w a table and a map or are they completely same ?


Thanks
Aug 17, 2014 at 9:35am
There are many different implementations for a "table" and there are different "maps". Which table and map do you mean?

Thus, the answer is: most likely different.
Aug 17, 2014 at 9:44am
I was just going through data structures and encountered the definition of Table as this :

A table(also called a map, a lookup table, an associative array ,or a dictionary) is a container that allows direct access by any index type .

that is why i asked ……. is this definition wrong then ?
Last edited on Aug 17, 2014 at 9:46am
Aug 17, 2014 at 10:04am
I would say "map" is a more precise word. A "table" could mean multiple things. If you just say "table", and it's not obvious from the context, it might not be clear if you mean a map, a database table or any data structure used to store tabular data.
Last edited on Aug 17, 2014 at 10:04am
Aug 17, 2014 at 4:00pm
A map has one index. A table, as per your definition, can have many. Tables like that are common in databases where you might want to lookup the same record (row in a table) using any one of several different column values within it.
Aug 17, 2014 at 4:26pm
The C++ standard has std::map and std::unordered_map. Whether they are "maps" is an another question, but even they differ from each other, because they have been implemented with different data structures. One is presumably a tree and the other a hash.
Topic archived. No new replies allowed.