1 Concepts of data structures and algorithms
- Data structure: a kind of arrangement for computer memory.
- Algorithm: The data in the structure of a variety of processing.
2 application aspects of data structures and algorithms
- ① real-World data storage
- ② Programmer's Tools
- ③ modeling of the real world
3 common data structures and pros and cons
- Array
- Pros: Insert fast (know subscript), Find Fast (find by index)
- Cons: Lookup slow (based on content lookup), delete slow, array length is fixed
- Ordered array
- Pros: Find blocks than unordered array
- Cons: Delete and insert slowly, the length of the array is fixed
- Stack
- Advantage: Provide last-in-first-out access mode
- Cons: Accessing other items is slow
- Queue
- Advantages: Provide first-in, out-of-the-way access
- Cons: Storing other items is slow
- Linked list
- Advantages: Quick Insert and delete
- Cons: Find slow
- Two-fork Tree
- Pros: Find, insert, delete faster (in case of tree balance)
- Cons: Deleted algorithms are more complex
- Red and black tree (balance tree)
- Pros: Find, insert, and delete are quick
- Cons: Algorithmic complexity
- 2-3-4 Tree (Balance tree)
- Pros: Find, insert, and delete are quick
- Cons: Algorithmic complexity
- Hash table
- Advantages: Quick Insert, get value by key fast
- Cons: Deleting a key without knowing it is relatively slow
- Heap
- Advantages: Fast insertion and deletion, fast access to maximum data items
- Cons: Slow access to other data items
- Figure
- Pros: Modeling the real world
- Cons: Some algorithms are slow and complex
Overview of data structures and algorithms