Home  >  Article  >  The sequential search method is suitable for linear tables with what storage structure?

The sequential search method is suitable for linear tables with what storage structure?

青灯夜游
青灯夜游Original
2020-08-29 15:00:1816008browse

The sequential search method is suitable for linear tables whose storage structure is "sequential storage or linked storage". Linear tables are mainly represented by sequential representation (sequential storage) or chained representation (linked storage); sequential representation refers to using a set of storage units with consecutive addresses to store the data elements of the linear table in sequence, and chained representation refers to using a set of arbitrary The storage unit stores the data elements in the linear table.

The sequential search method is suitable for linear tables with what storage structure?

Sequential search method

The sequential search method refers to searching one by one from beginning to end.

Search is one of the most commonly used algorithms in programming. Suppose you want to find whether the value of x exists from n integers. The most primitive way is to search one by one from beginning to end. This search method It's called a sequential search.

Linear table

Linear table is the most basic, simplest, and most commonly used data structure. A linear list is a type of data structure. A linear list is a finite sequence of n data elements with the same characteristics.

The relationship between data elements in a linear table is a one-to-one relationship, that is, except for the first and last data elements, other data elements are connected end to end (note that this sentence It only applies to most linear lists, not all. For example, a circular linked list is also a linear list at the logical level (it belongs to linked storage at the storage level, but the tail pointer of the last data element points to the first node).

Linear tables are mainly represented by sequential representation or chain representation. In practical applications, they are often used in special forms such as stacks, queues, and strings.

Sequential representation refers to using a set of consecutive addresses The storage unit stores the data elements of the linear table in sequence, which is called the sequential storage structure or sequential mapping of the linear table. It uses "physical location adjacent" to represent the logical relationship between the data elements in the linear table, and can be accessed randomly Any element in the table.

Linked representation refers to using a set of arbitrary storage units to store data elements in the linear table, which is called the linked storage structure of the linear table. Its storage units can be continuous , or it can be discontinuous. When expressing the logical relationship between data elements, in addition to storing its own information, it is also necessary to store information indicating its direct successor (that is, the storage location of the direct successor). These two Part of the information forms the storage image of the data element, which is called a node. It includes two domains; the domain that stores data element information is called the data domain; the domain that stores the immediate successor storage location is called the pointer domain. The pointer domain stores The information is called a pointer or chain.

For more related knowledge, please visit:PHP Chinese website!

The above is the detailed content of The sequential search method is suitable for linear tables with what storage structure?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn