en/docs/chapter_introduction/what_is_dsa.md
An <u>algorithm</u> is a set of instructions or operational steps that solves a specific problem within a finite amount of time. It has the following characteristics.
A <u>data structure</u> is a way of organizing and storing data, covering the data content, relationships between data, and methods for data operations. It has the following design objectives.
Data structure design is a process full of trade-offs. If we want to achieve improvements in one aspect, we often need to make compromises in another aspect. Here are two examples.
As shown in the figure below, data structures and algorithms are highly related and tightly coupled, specifically manifested in the following three aspects.
Data structures and algorithms are like assembling building blocks as shown in the figure below. A set of building blocks, in addition to containing many parts, also comes with detailed assembly instructions. By following the instructions step by step, we can assemble an exquisite building block model.
The detailed correspondence between the two is shown in the table below.
<p align="center"> Table <id> Comparing data structures and algorithms to assembling building blocks </p>| Data structures and algorithms | Assembling building blocks |
|---|---|
| Input data | Unassembled building blocks |
| Data structure | Organization form of building blocks, including shape, size, connection method, etc. |
| Algorithm | A series of operational steps to assemble the blocks into the target form |
| Output data | Building block model |
It is worth noting that data structures and algorithms are independent of programming languages. For this reason, this book is able to provide implementations based on multiple programming languages.
!!! tip "Conventional abbreviation"
In actual discussions, we usually abbreviate "data structures and algorithms" as "algorithms". For example, the well-known LeetCode algorithm problems actually examine knowledge of both data structures and algorithms.