0% found this document useful (0 votes)
6 views

1.Data structure

Data structure refers to the organization, management, and storage format of data in computer memory, enabling efficient access and modification. It can be classified into linear data structures, such as arrays and queues, and non-linear data structures, such as trees. Key operations on data structures include searching, insertion, deletion, sorting, and merging, with specific examples like queues and stacks illustrating their practical applications.

Uploaded by

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

1.Data structure

Data structure refers to the organization, management, and storage format of data in computer memory, enabling efficient access and modification. It can be classified into linear data structures, such as arrays and queues, and non-linear data structures, such as trees. Key operations on data structures include searching, insertion, deletion, sorting, and merging, with specific examples like queues and stacks illustrating their practical applications.

Uploaded by

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

Subject Name: DATA STRUCTURE

DATA STRUCTURE:
Organization of data into computer memory is called data structure.
OR
The process of storing or retrieving of data in the computer memory is called
data structure. The structure deals with how data is organized in memory.
OR
Structure means particular way of data organization. So data structure refers to
the organization of data in computer memory.In other words, the way in which
data is efficiently stored processed and retrieved is called Data Structure.
OR
Data structure is “The logical or Mathematical representation of data in
computer memory”.
OR
In computer science, data structure is a data organization, management and
storage format that enable efficient access and modification.

TYPES OF DATA STRUCTURE


Data structure can be classified into groups
1. Linear Data Structure
2. Non Linear Data Structure
1. Linear Data Structure:
The organization of data in a sequence is called linear data
structure. A data structure is linear when all the elements are
arranged in a linear (sequential)order. such as Array, Link list,
Queues, Stacks etc.
Example of Linear Data Structure:
Array, Link list, Queues, Stacks etc.
2. Non Linear Data Structure:
A data structure is nonlinear when all the elements are not
arranged in a linear(sequential) order. There is no linear
arrangement of the elements.
OR
The organization of data in hierarchical form in which each data
item have more than oneSucceeding nodes (data items) but only one preceding
node except 1st and last.
OR
None linear data structure is type of data structure in which the
data is stored in non-consecutive memory locations OR data is
stored in non-sequential form.
Example of None Linear Data structure:
Trees, Graphics etc.
DATA STRUCTURE OPERATIONS

1. Searching:
This operation is use to search the specific element in the data structure./Find the
location of data in data structure.
2. Insertion:
This operation is use to insert the element in the data structure./ Add a new data in the
data structure./ inserting new element in a given Data Structure.
3. Deleting:
This operation is use to delete the element from data structure. /Remove a data from
the data structure. /Removing an element from an existing data structure OR dropping
/deleting a record from the entity record form the entity is called deletion.
4. Sorting:
This operation is use to arrange the all elements in the specific order. /Arrange data in
increasing or decreasing order.
5. Merging:
This operation is use to combine two stored files in one stored. /Combing the data of
two different sorted files into a single sorted file.

Traversing/Accessing:
Accessing each data exactly one in the data structure so that each data item is
traversed or visited. /Traversing means accessing /processing. Accessing each
record from a relation exactly one.
QUEUE
 It is a linear data structure; In which insertions are done at one end (rear) and
deletion are done at other end (front).
 In which elements are inserted from the back end and deleted from front end.
 The front end of Queue is called as front or head and the back end of
Queue is called Rear or tail.
 Queue is a line of items waiting to be served in sequential order.
It follows the rule of First in First out (FIFO),Which means that
element inserted first will also be removed first .
 In Queue, the order in which the data arrives is important.

 The process to add an element into Queue is called Enqueue and the process of
removal of an element from Queue is called Dequeue.

Examples of Queue

Everyday life examples:


i. People waiting in line at bank in order to deposit their bills form
a queue.
ii. The people waiting for tickets at the cinema.
iii. The cars at a police check post form queue.
iv. The people waiting in a line at a bank form a queue, When
were the first person in line is the first person to be waited on.
Computer Science Examples
1. An important example of queue in computer science occurs is a
timesharing systemin which programs with the different
priorities form a queue while waiting to be executed.
2. In network environment the users send their request to server,
the printer requests are stored. These request are printed first
which are entered first.
Applications of Queue:

1. In real life, call center phone systems will use Queues, to hold people
calling them in an order, until a service representative is free.
2. In daily life, we wait in Queues to buy pizza, to enter movies theaters.

DOUBLE –ENDED QUEUE (DE-QUE)

 A De-queue is linear list in which elements can be added


(inserted) or deleted (removed) at the both ends of de-queue
but not in middle. The term de-queue is a contraction of the
name double-ended-queue.
 In a standard queue a character is inserted at the back and deleted in the
front, however,
 In a double-ended queue, characters can be inserted and deleted from
both the front and back of the queue.
 In this insertion and deletion can be performed at both end i.e front
pointer can be used for insertion and rear pointer can be used for deletion.
Types of Deque
There are two types of Deque
1. Input restricted Deque
2. Output restricted Deque

1.Input restricted Deque:


Insertion at only one end deletion at both ends.
2. Output restricted Deque:
Deletion at one end Insertion at both the ends.
STACK

Stack Definition:
 It is a linear data structure where insertion of elements or deletion of
elements is done only one side/end which is called top of the stack.
 Stack is a type of linear data structure .By linear we mean that elements
are stored in continuous memory location in computer memory. A stack
is a list of elements in which elements may be inserted or deleted only at
one end called ‘top of the stack’.
 It means that the elements are removed from a stack in the reverse order
of which they were inserted into the stack.
 Insertion of element to stack is called “Stacking or PUSH”. And deletion
of an element from the stack is called “Un stacking or POP.
 Stack follows the rule “LIFO” (Last in First out) and “FILO” (First in
Last out).
EXAMPLES
Daily Life examples of Stack:
1. Stack of Plates
2. Stack of books
3. A pile of trays in cafeteria
4. Wearing of bangles
5. Wearing of cloths
6. Omission of employee form the organization on the basis of seniority
card.

Operations on Stack
The following operations are performed on the stack.
i. Create stack
ii. PUSH
iii.POP
iv. Empty stack:
v. Destroy stack:
i. Create stack:
This operation creates an empty stack.
ii. PUSH:
The term which is used to insert an element into stack is called PUSH or
stacking.
The steps are as follows:
i. Access the top or stack pointer
ii. If stack is full (overflow), refuse entry or stacking.
iii. Increment the top or stack pointer.
iv. Store the data at location specified by the top or stack pointer.
iii.POP:
It is the term used to delete or remove an element from a stack. The
steps are as follows:
i. Check the stack is empty (underflow), refuse pop un-stacking.
ii. Remove the top element from stack.
iii. Decrement the top or stack pointer.
iv. Empty stack:
The result of this operation is false because stack is not empty .it
Represents that the value return is logic (0).
OR
This Boolean operation checks whether the stack is empty or not.
If there is no element in the stack then this operation will return
True value.
v. Full Stack:
The stack of this operation is also false because the stack is not full
i.e Boolean value 0.
If the stack is full then the Boolean value will be true.
iv. Destroy stack:
This operation checks if the stack full then remove all the
elements from the stack leaving it empty.

Stack applications:
i. Expression Evaluation:
It is sued to evaluate prefix infix postfix expression.
ii. Expression conversion:
Stack can be used to convert one form of expression to another.
iii. String reversal:
It is used to reverse the string.
iv. Function call:
It is used to keep information about the active functions or subroutines,
v. Syntax Parsing:
Many compilers sue a Stack for parsing the syntax
of expressions, program block etc. before translating into low level code.
vi. Back tracking:
Stack can be used in backtracking.
vii. Parenthesis checking:
Stack is used to check the proper opening and closing of parenthesis.
viii. Memory Management:
Stack is also used in memory management.

Difference between Stack & Queue


Stack Queue

1.Stack follow LIFO operation i.e last in 1.Queue follow FIFO operation i.e First
First out. in First Out.

2. Insertion and deletion takes place on 2. Insertion and deletion takes on


one end. opposite end.
3. Stack doesn’t have any type. 3.Queue has various type like circular
queue , double queue.
4. In stack only one pointer is used i.e 4.But ,in queue two different pointer are
top of the stack. used i.e Rear & Front.

--------------------------------------------------------------------------------

You might also like