What is Data Structure?

Data structure is a way of storing, organized and systematic data organization so that data can be used effectively.

Here are two fundamental concepts that form a data structure:

Interface : Each data structure has an Interface. The interface represents a set of calculations that a data structure supports. An Interface provides only a list of supported calculations, the types of parameters they can accept and the return type of these operations.

Implementation (can be understood as implementation) : Provides internal representation of a data structure. Implementation also provides a definition of the algorithm used in data structure calculations.

Characteristics of a Data Structure

Exactly : The implementation of the Data Structure should implement its Interface correctly.

Time complexity (Time Complexity) : Runtime or execution time of data structure calculations must be as small as possible.

Memory complexity (Space Complexity) : The memory usage of each calculation of the data structure should be as small as possible.

Why is data structure necessary?

Today, applications are increasingly complex and the amount of data is growing with a variety of types. This presents three major problems that every developer faces:

Searching for data : Suppose there are 1 million goods stored in stock. And suppose there is an application needed to search for a goods. Every time I do a search, this app will have to search for 1 item in 1 million goods. As the data increases, the search will become more and more slow and expensive.

Processor speed : Although the processor has a very high speed, it is also limited and when the amount of data is up to billions of records, the processing speed will no longer be fast.

Multiple requirements : When thousands of users perform a search operation on a Web Server, no matter how fast the Web Server is, it is really difficult to handle thousands of calculations at once.

To handle the above problems, data structures are a great solution. Data can be organized in a data structure in such a way that when a search of an element is performed, the requested data is immediately found.

Implementation time complexity in data structures and algorithms

There are 3 cases that are often used to compare the execution time of different data structures:

Worst case (Worst Case) : is a situation where a calculation of certain data structures takes maximum time (the longest time). For example, with three numbers 1, 2, 3, if sorted in descending order, the execution time will be the longest (and this is the worst case); if sorted in ascending order, execution time will be the shortest (and this is the best case).

Average Case : describes the average execution time of a calculation of a data structure.

Best Case : A situation where the execution time of a calculation of a data structure is the least. Example as above.

Basic terminology in Data Structures

Data : Data are values ​​or a set of values.

Data element : Data element is a single unit of value.

Group elements : Data elements that are divided into sub-elements are called group elements.

Basic elements : Data elements that cannot be subdivided into child elements are called basic elements.

Attributes and Entities : An entity is something that contains certain attributes, and these attributes can be assigned values.

Entity aggregation : Entities that have similar attributes constitute an entity set.

Field : A field is a basic information unit representing an attribute of an entity.

Record : A record is a set of field values ​​of a given entity.

File : A collection of records of entities in a given entity set.

According to Tutorialspoint

Previous article: Web programming in C ++

Next lesson: Setting environment in Data structure

4 ★ | 1 Vote

May be interested

  • Environment settings in Data structuresPhoto of Environment settings in Data structures
    because c and c ++ languages ​​are the languages ​​that almost every university uses to teach, in this chapter i will guide you to install c and c ++ to run the examples in the configuration series. structure and algorithm.
  • Array data structurePhoto of Array data structure
    array (array) is one of the oldest and most important data structures. arrays can store some fixed elements and these elements have the same type. most data structures use arrays to implement algorithms. here are the important concepts related to arrays.
  • What is algorithm?Photo of What is algorithm?
    algorithms (also known as algorithms - english is algorithms) is a finite set of instructions to be executed in a certain order to get the desired result. in general, the algorithm is independent of programming languages, ie an algorithm can be deployed in many different programming languages.
  • Asymptotic analysis in Data Structures and AlgorithmsPhoto of Asymptotic analysis in Data Structures and Algorithms
    the asymptotic analysis of an algorithm is a concept that helps us estimate the running time of an algorithm. using asymptotic analysis, we can draw the best conclusions about the best case scenario, the average case, the worst case of an algorithm.
  • Greedy Algorithm (Greedy Algorithm)Photo of Greedy Algorithm (Greedy Algorithm)
    greedy algorithm is a combination optimization algorithm. search algorithms, select local optimal solutions in each step in the hope of finding a global optimal solution.
  • Dynamic Programming (Dynamic Programming)Photo of Dynamic Programming (Dynamic Programming)
    dynamic programming algorithms are like divide and conquer algorithms in breaking down problems into smaller subproblems and then into smaller subproblems. but unlike dividing to treat, these subproblems are not solved independently. instead, the results of these subproblems are saved and used for similar subproblems or overlapping sub-problems.