by BehindJava

What are Data Structures and its examples

Home » datastructures » What are Data Structures and its examples

In this blog, we are going to learn about data structures and its examples.

Overview of Data Structures

  • Data Structures are a method of representing of logical relationships between individual data elements related to the solution of a given problem.
  • A data structure is a structured set of variables associated with one another in different ways, co-operatively defining the components in the system and capable of being operated upon in the program.
  • Data structures are the basis of the programming tools. The choice of data structures should provide the following:

    1. The data structure should satisfactorily represent the relationship between the data elements.
    2. The data structure should be easy so that the programmer can easily process the data.

Classification of Data Structures

  • Linear: The values are arranged in a linear fashion. E.g. Arrays, Linked Lists, Stacks, Queues etc.
  • Non-Linear: The values are not arranged in an order. E.g. Tree, Graph, Table etc.
  • Homogeneous: Here all the values stored are of same type e.g. arrays
  • Non- Homogeneous: Here all the values stored are of different type e.g. structures and classes.
  • Dynamic: A dynamic data structure is one that can grow or shrink as needed to contain the data you want stored. That is, you can allocate new storage when it’s needed and discard that storage when you’re done with it. E.g. pointers, or references
  • Static: They’re essentially fixed-size and often use much space E.g. Array.

Data Structure Operations

Data Structures are processed by using certain operations.

  1. Traversing: Accessing each record exactly once so that certain items in the record may be processed.
  2. Searching: Finding the location of the record with a given key value, or finding the location of all the records that satisfy one or more conditions.
  3. Inserting: Adding a new record to the structure.
  4. Deleting: Removing a record from the structure.

Special Data Structure-Operations

  1. Sorting: Arranging the records in some logical order (Alphabetical or numerical order).
  2. Merging: Combining the records in two different sorted files into a single sorted file.