2021-09-23 03:33:54 +00:00
|
|
|
= Stack =
|
|
|
|
|
|
|
|
First in Last Out container. Think like a stack of plates, you take off the top
|
|
|
|
first. Really speciallized and great for things like pre/postfix parsing and
|
|
|
|
like
|
|
|
|
|
|
|
|
== Good For ==
|
|
|
|
|
|
|
|
* Keeping an order of things added
|
|
|
|
|
|
|
|
== Bad For ==
|
|
|
|
|
|
|
|
* Everything else
|
|
|
|
|
2021-09-23 17:54:24 +00:00
|
|
|
== Optomize ==
|
|
|
|
|
|
|
|
You can make this either just an array with a pointer to the top of the stack,
|
|
|
|
or as a big single linked list that keeps track of the head. Use the array when
|
|
|
|
you know the max number of elements, otherwise use a linked list. If caching is
|
|
|
|
a concern, use the array version.
|
|
|
|
|
2021-09-23 03:33:54 +00:00
|
|
|
[[algorithms]]
|