Data structures

When data is ordered, working with large amounts of data is easier to automate. To do this, use data structures, among which you can select the following: linear (lists), tabular, hierarchical (tree).

Linear data structures (or lists) are ordered structures in which the address of a given is uniquely determined by its number (index). An example is the list of the training group.

As a rule, a new element in linear data structures begins with a new line. If the elements are placed in a line, you need to make a separating sign between the elements. Search is carried out on the separators (to find, for example, the tenth element, you need to count nine delimiters).

A structure is called a data vector, if the list items are the same length, no delimiters are required. If the length of one element of such a data structure is d, knowing the number of the element - n, the beginning is determined by the relation d*(n-1).

Tabular data structures are ordered structures in which the data address is uniquely determined by two numbers - the row number and the column number, at the intersection of which there is a cell with the desired element.

If the elements of the data structure are in line, you need to enter two separating characters - a separating sign between the elements of the line and the separating sign between the lines.

Similarly to the linear structure, the search is performed on the delimiters. The structure is called a data matrix, if the elements of the table are of the same length, then the delimiters in it are not required. Given the length of one element - d, knowing the line number - m and the column number - n, as well as the rows and columns M, N, you can find the address of its beginning: d*(N(m-1) + (n-1)).

Data structures can also be three-dimensional, then three numbers characterize the position of the element and three types of separators are required, and can be n -dimensional.

Hierarchical data structures are structures in which the address of each element is determined by the path of access from the top of the structure to that element. Irregular data that is difficult to present as a list or table can be presented in a hierarchical structure. For example, a hierarchical structure is formed by postal addresses.

Hierarchical data structures are more complex than linear and tabular. If a new element appears in the linear element, then the ordering is reduced. For example, if a new person appears in the list of students, then the alphabetically listed list is violated.

In the hierarchical data structure, the introduction of a new element does not violate the structure of the tree. Its disadvantage is the complexity of recording the address and the complexity of ordering.