0% found this document useful (0 votes)
23 views6 pages

DS Notes

DS NOTES

Uploaded by

jignasha.patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views6 pages

DS Notes

DS NOTES

Uploaded by

jignasha.patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Data Structures (3130702)

CHAPTER: 2 INTRODUCTION TO DATA STRUCTURE

Classification of Data Structures


We can classify Data Structures into two categories:

1. Primitive Data Structure


2. Non-Primitive Data Structure

The following figure shows the different classifications of Data Structures.

Primitive Data Structures


1. Primitive Data Structures are the data structures consisting of the
numbers and the characters that come in-built into programs.
2. These data structures can be manipulated or operated directly by
machine-level instructions.
3. Basic data types like Integer, Float, Character, and Boolean come
under the Primitive Data Structures.
Data Structures (3130702)

4. These data types are also called Simple data types, as they contain
characters that can't be divided further

Non-Primitive Data Structures


- Non-Primitive Data Structures are those data structures derived from
Primitive Data Structures.
- These data structures can't be manipulated or operated directly by machine-level
instructions.
- The focus of these data structures is on forming a set of data elements that is
either homogeneous (same data type) or heterogeneous (different data
types).
- Based on the structure and arrangement of data, we can divide these data structures
into two sub-categories -
a. Linear Data Structures
b. Non-Linear Data Structures

Types of Linear Data Structures

Arrays:

Arrays can be classified into different types:

One-Dimensional Array: An Array with only one row of data elements is known as a One-
Dimensional Array. It is stored in ascending storage location.
Two-Dimensional Array: An Array consisting of multiple rows and columns of data elements is
called a Two-Dimensional Array. It is also known as a Matrix.
Multidimensional Array: We can define Multidimensional Array as an Array of Arrays.
Multidimensional Arrays are not bounded to two indices or two dimensions as they can include
as many indices are per the need.
Data Structures (3130702)

Some Applications of Array:

-We can store a list of data elements belonging to the same data type.
-Array acts as an auxiliary storage for other data structures.
-The array also helps store data elements of a binary tree of the fixed count.
-Array also acts as storage of matrices.

Linked Lists

Linked Lists can be classified into different types:

- Singly Linked List: A Singly Linked List is the most common type of Linked List. Each
node has data and a pointer field containing an address to the next node.
- Doubly Linked List: A Doubly Linked List consists of an information field and two pointer
fields. The information field contains the data. The first pointer field contains an address
of the previous node, whereas another pointer field contains a reference to the next
node. Thus, we can go in both directions (backward as well as forward).
- Circular Linked List: The Circular Linked List is similar to the Singly Linked List. The only
key difference is that the last node contains the address of the first node, forming a
circular loop in the Circular Linked List.

Some Applications of Linked Lists:

- The Linked Lists help us implement stacks, queues, binary trees, and graphs of
predefined size.
- We can also implement Operating System's function for dynamic memory management.
- Linked Lists also allow polynomial implementation for mathematical operations.
- We can use Circular Linked List to implement Operating Systems or application functions
that Round Robin execution of tasks.
- Circular Linked List is also helpful in a Slide Show where a user requires to go back to the
first slide after the last slide is presented.
- Doubly Linked List is utilized to implement forward and backward buttons in a browser
to move forward and backward in the opened pages of a website.
Data Structures (3130702)

Stacks:

A Stack is a Linear Data Structure that follows the LIFO (Last In, First Out)
principle that allows operations like insertion and deletion from one end of
the Stack, i.e., Top. Stacks can be implemented with the help of contiguous
memory, an Array, and non-contiguous memory, a Linked List. Real-life
examples of Stacks are piles of books, a deck of cards, piles of money, and
many more.

The primary operations in the Stack are as follows:

Push: Operation to insert a new element in the Stack is termed as Push


Operation.

Pop: Operation to remove or delete elements from the Stack is termed as Pop
Operation.
Data Structures (3130702)

Some Applications of Stacks:

2. The Stack is used as a Temporary Storage Structure for recursive


operations.
3. Stack is also utilized as Auxiliary Storage Structure for function calls,
nested operations, and deferred/postponed functions.
4. We can manage function calls using Stacks.
5. Stacks are also utilized to evaluate the arithmetic expressions in different
programming languages.
6. Stacks are also helpful in converting infix expressions to postfix
expressions.
7. Stacks allow us to check the expression's syntax in the programming
environment.
8. We can match parenthesis using Stacks.
9. Stacks can be used to reverse a String.
10.Stacks are helpful in solving problems based on backtracking.
11.We can use Stacks in depth-first search in graph and tree traversal.
12.Stacks are also used in Operating System functions.
13.Stacks are also used in UNDO and REDO functions in an edit.

Queues:
Data Structures (3130702)

The following are the primary operations of the Queue:

Enqueue: The insertion or Addition of some data elements to the Queue is called Enqueue. The
element insertion is always done with the help of the rear pointer.

Dequeue: Deleting or removing data elements from the Queue is termed Dequeue. The
deletion of the element is always done with the help of the front pointer.

Some Applications of Queues:

- Queues are generally used in the breadth search operation in Graphs.


- Queues are also used in Job Scheduler Operations of Operating Systems, like a keyboard
buffer queue to store the keys pressed by users and a print buffer queue to store the
documents printed by the printer.
- Queues are responsible for CPU scheduling, Job scheduling, and Disk Scheduling.
- Priority Queues are utilized in file-downloading operations in a browser.
- Queues are also used to transfer data between peripheral devices and the CPU.
- Queues are also responsible for handling interrupts generated by the User Applications
for the CPU.

You might also like