Data Structure in C

226Views
No Comments

共计 1488 个字符,预计需要花费 4 分钟才能阅读完成。

A data structure is a way to store and organize data in a computer so that it can be used efficiently.

A data structure is a logical model of a particular organization of data.

We talk about data structure as:

  1. Mathematical / Logical Model or Abstract Data Types
  2. Implementation

Abstract Data Type

It defines data and operations but has no implementation.

The various data structures are divided into the following categories:

  1. Linear Data Structure
  2. Non-Linear Data Structure

Linear Data Structure

A data structure whose elements are in the form of sequence and every element in the structure has a unique predecessor (pre-existing) and unique successor (inheritor).

Example – Linked List, Arrays, Stacks, and Queues

Non-Linear Data Structure

A data structure whose elements are not in the form of sequence and there is no unique predecessor (pre-existing) and unique successor (inheritor).

Example – Trees and Graphs

Classification of Data Structure

  • Primitive Data Structure
  • Non-Primitive Data Structure

Primitive Data Structure

The primitive data structure is the data structure that is already defined in the C language. They can be used to store only a single value and have a fixed size that can’t be increased or decreased. They allocate memory in the main memory before execution.

Examples in C Language: int, char, float, double, etc.

Non-Primitive Data Structure

The non-primitive data structures in C are also known as the derived data structure. Because the non-primitive data structures are derived from the primitive data structures. The data stored in the non-primitive data structures can be manipulated using operations like insertion, deletion, searching, sorting, etc.

Examples in C Language: array, linked-list, queue, stack, tree, graph, etc.

正文完
 
Amitesh Kumar
Copyright notice: Our original article, by Amitesh Kumar 2023-02-04 publish, total 1488 words.
转载说明:Unless otherwise specified, all articles are published by cc-4.0 protocol. Please indicate the source of reprint.
Comment(No Comments)