Home  >  Article  >  What are the linear table operations?

What are the linear table operations?

hzc
hzcOriginal
2020-06-24 14:24:474786browse

What are the linear table operations?

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).

Basic operations

  • ##MakeEmpty( L) This is a method to turn L into an empty list

  • ##Length (L) Returns the length of table L, that is, the number of elements in the table
  • Get(L,i) This is a function whose value is the element at position i in L (1≤i≤n)
  • Prior(L,i) Get The predecessor element of i
  • Next (L, i) Take the successor element of i
  • Locate (L, x) This is a function, The function value is the position of element x in L
  • Insert (L, i, x) inserts element The elements are pushed back one position
  • Delete(L, p) Delete the element at position p from table L
  • IsEmpty( L) If table L is an empty table (length is 0), return true, otherwise return false
  • Clear (L) Clear all elements
  • Init (L) is the same as the first one, the initialized linear table is empty
  • Traverse (L) traverses and outputs all elements
  • Find (L , x) Find and return element
  • Update(L, x) Modify element
  • Sort(L) Re-press all elements as given Conditional sorting
  • strstr(string1,string2) is used to find the first address of string2 in string1 for character array

The above is the detailed content of What are the linear table operations?. 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