Data Structures in MATLAB
15 views (last 30 days)
Erik Johannes Loo on 6 Dec 2021
Hello, I hope this is an appropriate question to ask in here.
As part of continous learning, I took a course on ordered/unordered data structures and I will present the key points to my co-workers (different types of data structures, use cases, etc).
We mostly use MATLAB, so I was looking for pointers to make my presentation more appropriate.
As far as I know:
arrays/vectors are represented by MATLAB matrices
stacks/queues would also be represented by MATLAB matrices
lists - do they have a native representation?
hash tables (unordered maps) are represented by Containers.Map
binary trees (binary searcht trees, red-black trees, ordered maps/sets/dicts) - do they have a native representation?
min/max-heap - do they have a native representation?
graphs - I suppose it makes sense to manually implement graphs.
cell arrays - what are they / how are they implemented?
tables - what are they / how are they implemented?
I know this is a bit of a "theoretical" question but I would be very grateful to get some answers or be pointed towards documentation as I would not like to present erroneous information.
Bharat Chandra Mukkavalli on 11 Jul 2022
To answer your query,
1) MATLAB does not have a "list" data class.
2) Trees are present in MATLAB in the "NTREE" class, the documentation can be found here: https://in.mathworks.com/help/wavelet/ref/ntree.html
3) Heaps Class is present in MATLAB and internally I believe max-heap is implemented, the implementation can be found here: https://in.mathworks.com/matlabcentral/fileexchange/34218-heap
4) MATLAB has the "graph" class to implement the graph data structure, the documentation can be found here: https://in.mathworks.com/help/matlab/ref/graph.html
5) Here is the documentation of Cell Arrays in MATLAB: https://in.mathworks.com/help/matlab/cell-arrays.html?s_tid=CRUX_topnav
6) Here is the documentation of Tables in MATLAB: https://in.mathworks.com/help/matlab/tables.html
Hope this helps!