Data Structure And Algorithm - Common Types

Hello friends,

After quite some time, I am resuming my writing and it is with data structure and algorithm.

Data Structure and Algorithms are the foundation of computer science and knowing them well can help strengthen the concepts and their implementation that goes behind the scene.

At this point, the majority of content in these topics are available in C, C++, Java, and Python and my goal is to make them available in C#.

In today’s article, we will cover the types of data structure.

Before anything else, lets first define the data structure-

Per Wikipedia,

In computer science, a data structure is a data organization, management, and storage format that enables efficient access and modification.

More precisely, a data structure is a collection of data values, the relationships among them, and the functions or operations that can be applied to the data.

It is clear from the definition that Data Structure is all about dealing with the structure and storage of data.

Now let’s look into their types.

Primitive & Non-Primitive Data Structures

Primitive types are the one that comes built-in with platforms and are used to store most common data such as integer, float, string, date, etc.

On the contrary to primitive types, non-primitive types are used to store little bit complex structures such as Stack, List, Tree, Graph, etc.

Non-primitive types are further divided into Linear and non-linear categories depending on their storage types.

The following diagram illustrates the most common types.

Data Structure And Algorithm - Common Types

If you are new to this domain, following diagram can help you to visually understand the storage mechanism of commonly used data structures.

Data Structure And Algorithm - Common Types

Let’s try to understand them in a little more detail.

Linear Data Structure

In Linear data structure, values are arranged in a linear fashion. Below are some examples of linear data structure.

  • Array: Fixed-size linear data structure that is most commonly used.
  • Linked-list or List: Variable-size linear data structure used especially when we aren’t sure of the size in advance.
  • Stack: Linear data structure that adds data to the top and removes from the top
  • Queue: Linear data structure that adds to back and remove from front

Non-Linear Data Structure

The data values in this structure are not arranged in order. Below are some examples in this category.

  • Hash tables: Unordered lists which use a ‘hash function’ to insert and search
  • Tree: Data is organized in branches.
  • Graph: A more general branching structure, with less strict connection conditions than for a tree

Apart from the set of categories described above, one more category exists such as homogeneous & heterogeneous Data Structures.

Homogeneous and Heterogeneous Data Structures

In Homogenous data structures, values of the same types of data are stored. Example is Array

On the contrary, in Heterogeneous data structures, data values of different types are grouped and stored. Examples can be Structures and Classes 

Data Structure And Algorithm - Common Types

References

Summary

In today’s article, we have gone through the basics of data structure and its most common categories. It’s important that we understand the basic premises behind any data structure and where they can be used. While understanding different data structures is important, applying them to appropriate use cases is even more important.

Hope this article was useful to you. You can let me know with comments and feedback.


Similar Articles