A (general) algorithm is a procedure accepting arguments of any data type that satisfies certain properties (invariant, concept).
A data structure, or abstract data type, is an invariant-defined set of data types which is studied for the analysis of algorithms.
The design, implementation and use of general algorithms is called generic programming.
- Set: a collection of unique values.
- List (linked list): every element has a key and a reference, with linear structure and insertion or removal from anywhere during iteration.
- Stack (FILO): a container with insert/push and delete/pop operation at one end (top).
- Queue (FIFO, buffer): a container with insert/enqueue at one end (back) and delete/dequeue at another (front).
- Tree (hierarchy): every element/node has one parent except the root, and may have one value/key.
- Heap (priority queue): The key of a parent node is always no greater/less than those of its children.
- Graph: mapping within a set which can represent connection, directed link, and weight.
- Associative array (map, dictionary): a collection of key-value pairs, where keys are unique.
- hash table: a hash function separates each key into a separate bucket of an array.
- search tree: ordered, optimized for search.
- Multimap: a collection of keys potentially associted with multiple values.