What are the Types of Data structures

 What are the Types of Data structures

What are the Types of Data structures


In the journey of learning Introduction to Data Structures we are progressing now to the types of data structures.

In this post, we will be discussing various types of data structures.

Types of Data Structures

There are two types of data structures: linear and non-linear. Let's discuss each one.

linear data structure

1.Linear Data Structures

A data structure is considered linear when all the elements are arranged in a sequential or linear order. In other words, if the elements are arranged in a linear order, the data structure is considered linear. Examples of linear data structures include:

  • Arrays
  • Linked Lists
  • Stacks
  • Queues

2.Non-Linear Data Structures

Non-linear data structures are those that do not have a sequential or linear order. They are typically hierarchical in nature, and the elements are connected in a way that can be represented as a tree-like structure. Examples of non-linear data structures include:

  • Trees
  • Graphs
  • Hash Tables

 What are Linear Data Structures

Linear data structures include arrays, queues, linked lists, and stacks. These structures are considered linear because each element of the structure has only one predecessor and one successor.

When we analyze the given data structure, we can conclude that it is a linear data structure. In this particular example, each element only has one predecessor and one successor. For instance, the current element being analyzed has one predecessor and one successor. However, there are two exceptions to this rule. The first element in the structure has no predecessor while the last element has no successor.

This passage discusses an exception in a data structure where each element has a certain property.

Each element in a data structure has one predecessor and one successor. However, data structures can also be non-linear, where elements are not arranged in a sequential order. One example of a non-linear data structure is a tree.

In this section, we will discuss a non-linear data structure. As shown in the labeled diagram, this data structure is not linear because each node does not have a single predecessor and successor. For instance, the node highlighted has one predecessor but two successors.

It is evident that data structures can be classified as either linear or non-linear. Graphs serve as an example of a non-linear data structure, as opposed to linear data structures.

non linear data structure

Static vs Dynamic Data Structures

When it comes to data structures, we can make further distinctions between static and dynamic structures. Static data structures are those where memory is allocated at compile time.

On the other hand, dynamic data structures allocate memory during runtime.

Fixed Size Data Structure

Fixed size data structures have a predetermined size that is set at compile time. This means that the maximum size is fixed, and cannot be changed during runtime. The advantage of using such a data structure is that it allows for fast access to data.

However, one drawback is that the size cannot be adjusted dynamically during runtime.

==========================================

So, we have seen here the types of data structures. now in next lecture, we will see about "Basics of Asymptotic Analysis"

Lets go to the  Next page.






























































































































Post a Comment

Contact Form