Junior — Middle
Can you list the main types of data structures and storage formats in databases?
sobes.tech AI
Answer from AI
Main types of data structures commonly used in programming and databases:
- Arrays — ordered collections of elements of the same type.
- Linked lists — sequences of elements where each contains a reference to the next.
- Stacks — structures with access based on LIFO (last in, first out).
- Queues — structures with access based on FIFO (first in, first out).
- Trees — hierarchical structures, such as binary trees, B-trees.
- Hash tables — structures for fast key-based lookup.
- Graphs — sets of nodes and edges between them.
Formats for storing information in databases:
- Tabular (relational) — data stored in tables with columns and rows (e.g., SQL databases).
- Document-oriented — data stored as documents (JSON, BSON), e.g., MongoDB.
- Key-value — pairs of keys and values, e.g., Redis.
- Column-oriented — data stored by columns, optimal for analytics (e.g., Cassandra).
- Graph databases — store data as graphs, suitable for complex relationships (e.g., Neo4j).