Algorithm study notes (1) algorithm basis

1. The relationship between data structure and algorithm

  1. Data structure (data structure) is a discipline that studies the way of organizing data. With a programming language, there is also a data structure. Learn the data structure and write more beautiful and efficient code.

  2. To learn the data structure well, you must consider how to solve the problems encountered in life and use programs to solve them.

  3. Program = data structure + algorithm

  4. The data structure is the foundation of the algorithm. In other words, if you want to learn the algorithm well, you need to learn the data structure in place.

Two, linear structure and nonlinear structure

The data structure includes: linear structure and non-linear structure.

2. Linear structure
  1. As the most commonly used data structure, linear structure is characterized by a one-to-one linear relationship between data elements.
  2. Linear structure has two different storage structures, namely sequential storage structure (array) and chain storage structure (linked list). The linear table stored sequentially is called the sequential table, and the storage elements in the sequential table are continuous.
  3. A linear list stored in a chain is called a linked list. The storage elements in the linked list are not necessarily continuous. The element nodes store data elements and the address information of adjacent elements.
  4. Common linear structures are: arrays, queues, linked lists, and stacks.
3. Non-linear structure

Non-linear structures include: two-dimensional arrays, multi-dimensional arrays, generalized tables, and tree structures.

Guess you like

Origin blog.csdn.net/weixin_46822085/article/details/109156196