# Introduction to Data Structures - Infovistar

### Data

Data is a collection of numbers, alphabets and symbols combined to represent information. A computer accepts the raw data as input and after processing of data, it produces improved data as output.

• Atomic data:

Atomic data are the non-decomposable entity. For example, an integer value 111 or a character value "J" cannot be further divided.

• Composite data:

It is a composition of several atomic data and it can be further divided into atomic data. For example, the Date of birth (05/07/1995) can be separated into three atomic values. The first one gives the day of the month, the second one gives the month and the last one is the year.

### Data Types

A data type is a set of values and a set of operations defined on those values.

Example: int age; [age can hold, integer type of data]

Every programming language has a method for declaring a set of variables of a particular type.

ADT in programming language means a user-defined extension to the native data types available in the programming language.

It consists of:

• A set of values
• A set of operations

In ADT, the implementation details remain hidden from the user. ADT is widely referred to as object-based programming.

### Data Structure

The data structure indicates the following things:

• Organization of data
• Associativity among data elements
• Accessing methods
• Operations on data
• Processing alternatives for data

The data structure deals with the representation of data considering not only the elements stored but also their relationship with each other.

A well-suited data structure must be chosen so that the relationship between data elements can be expressed. A data structure is an instance of an ADT.

### Types of Data Structures

• Primitive data structures:

The primitive data structures are primitive data types. The int, char, float, double, and pointer are the primitive data structures that can hold a single value.

• Non-primitive data structures:

The non-primitive data structure is divided into two types:

• Linear:

Elements are arranged sequentially is known as Linear data structure. A one-to-one relationship can be handled by the linear data structure. Arrays, Linked lists, Stacks, and Queues are examples of Linear data structures.

• Non-linear:

All one-to-many, many-to-one, and many-to-many relationships are handled by Non-linear data structures. Trees, graphs, and tables are examples of Non-linear data structures.

### Operations on Data Structures

The common operations are performed on data structures are:

• Traversing:

A data structure is accessing each element and accessing only once.

• Searching:

Finding the location of elements within the given data structure.

• Insertion:

Adding the new element in a data structure.

• Update:

Update the element, i.e. replace the element with another element.

• Deletion:

Removing the element from the data structure.

• Sorting:

Arranging the elements of a data structure either in an ascending or descending order.