Skip to content

Commit d481249

Browse files
authored
Create data_structures_advanced.mmd
1 parent a8c6987 commit d481249

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
```mermaid
2+
flowchart LR
3+
Start((Start))
4+
Start --> OrderImportant{Order is Important?}
5+
6+
%% Order‐important branch
7+
OrderImportant -- yes --> LIFO{Last In, First Out?}
8+
LIFO -- yes --> stack[stack]
9+
LIFO -- no --> FIFO{First In, First Out?}
10+
FIFO -- yes --> queue[queue]
11+
FIFO -- no --> BestIn{Best In, First Out?}
12+
BestIn -- yes --> priority_queue[priority_queue]
13+
BestIn -- no --> KeepSorted{Keep Sorted Elements?}
14+
15+
KeepSorted -- yes --> MainPurpose{Main Purpose}
16+
KeepSorted -- no --> InsertMiddle{Insert/erase at middle?}
17+
18+
InsertMiddle -- yes --> Frequent{Frequent Traversals?}
19+
InsertMiddle -- no --> InsertFront{Insert/erase at front?}
20+
21+
Frequent -- yes --> list[list]
22+
Frequent -- no --> InsertFront
23+
24+
InsertFront -- yes --> deque[deque]
25+
InsertFront -- no --> Persistent{Persistent Positions?}
26+
27+
Persistent -- yes --> deque
28+
Persistent -- no --> SizeVaries{Size varies widely?}
29+
30+
SizeVaries -- yes --> deque
31+
SizeVaries -- no --> vector[vector]
32+
33+
MainPurpose -- "In-order Traversals" --> sorted_vector["vector (sorted)"]
34+
MainPurpose -- "Look-up Keys" --> Lookup{Look-up Keys?}
35+
36+
%% Order‐not‐important & lookup branch
37+
OrderImportant -- no --> Lookup
38+
Lookup -- no --> InsertFront
39+
Lookup -- yes --> AllowDup{Allow Duplicates?}
40+
41+
AllowDup -- no --> Sep1{Separate Key/Value?}
42+
AllowDup -- yes --> Sep2{Separate Key/Value?}
43+
44+
Sep1 -- yes --> unordered_map[unordered_map]
45+
Sep1 -- no --> unordered_set[unordered_set]
46+
47+
Sep2 -- yes --> unordered_multimap[unordered_multimap]
48+
Sep2 -- no --> unordered_multiset[unordered_multiset]
49+
```

0 commit comments

Comments
 (0)