Home >Common Problem >What is an algorithm in data structure?
Sartaj Sahni said in his book "Data Structures, Algorithms and Applications": "A data structure is a data object and the various relationships that exist between instances of the object and the data elements that combine to form an instance. . These connections can be given by defining related functions." He defined a data object as "a data object is a collection of instances or values."
Clifford A. Shaffer's definition in the book "Data Structure and Algorithm Analysis" is: "Data structure is the physical implementation of ADT (Abstract Data Type)."
Big words Data Structure: A data structure is a collection of data elements that have one or more specific relationships with each other.
Grandma: The data structure includes the set of data objects and how they are organized in the computer, that is, their logical structure and physical storage structure. It also includes the set of operations related to the set of data objects, and the methods to implement these operations. The most efficient algorithm.
Personal: It is to convert books in the library into some character data and store them in the computer, as well as to operate on these data object sets. Such as finding books, placing books, etc.
Again, let’s take the example of a library. If it’s exhausting to search through each book, it would be much faster if there was an index to find which category to look for first. How to find is actually an algorithm.
An algorithm is a limited set of steps to solve a problem, usually described in pseudocode in a certain computer language. Time complexity and space complexity are usually used to measure the quality of an algorithm.
The five characteristics of algorithms: input, output, finiteness, certainty, and feasibility.
Input: Zero or more inputs.
Output: one or more outputs.
Finiteness: Completed within an acceptable time after finite steps.
Certainty: Each step has a definite meaning without ambiguity.
Feasibility: Every step is feasible.
Algorithm design requirements: correctness, readability, robustness, high time efficiency and low storage.
Correctness: There are inputs and outputs, no ambiguity, and correct answers.
Readability: Easy to read.
Robustness: illegal input can be processed
High time efficiency and low storage: the lower the time and space complexity, the better
The above is the detailed content of What is an algorithm in data structure?. For more information, please follow other related articles on the PHP Chinese website!