0% found this document useful (0 votes)
33 views16 pages

Charles Lee - C Promgramming Presentation

A data structure is a scheme for organizing data in computer memory. There are several common data structures including arrays, linked lists, stacks, queues, and trees. Stacks and queues are specialized data structures that operate on a first-in, last-out (LIFO) principle for stacks and a first-in, first-out (FIFO) principle for queues. Common queue types include normal queues, circular queues, double-ended queues, and priority queues. The choice of data structure depends on efficiently representing relationships in real-world data and enabling effective processing of that data.

Uploaded by

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

Charles Lee - C Promgramming Presentation

A data structure is a scheme for organizing data in computer memory. There are several common data structures including arrays, linked lists, stacks, queues, and trees. Stacks and queues are specialized data structures that operate on a first-in, last-out (LIFO) principle for stacks and a first-in, first-out (FIFO) principle for queues. Common queue types include normal queues, circular queues, double-ended queues, and priority queues. The choice of data structure depends on efficiently representing relationships in real-world data and enabling effective processing of that data.

Uploaded by

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

C DATA

STRUCTURES
Submitted byShrema Garg
Adity Dahal
Abhishek
Farrukh

WHAT IS A COMPUTER
PROGRAM?
To exactly know, what is data structure? We must know:
What is a computer program?

Input

Some mysterious
processing

Output

INTRODUCTION
A data structure is a scheme for organizing data
in the memory of a computer.
The way in which the data is organized affects
the performance of a program for different tasks.
Computer programmers decide which data
structures to use based on the nature of the
data and the processes that need to be
performed on that data.

STEPS IN DATA STRUCTURES


Logical or mathematical description of the structure
Implementation of the structure on the computer
Quantitative analysis of the structure, which includes
determining the amount of memory needed to store the
structure and the time required to process the structure
Data may be organized in many ways
E.g., arrays, linked lists, trees etc.

The choice of particular data model depends on two


consideration:
It must be rich enough in structure to mirror the actual
relationships of data in the real world
The structure should be simple enough that one can effectively
process the data when necessary

WHAT DATA STRUCTURE TO


USE?
array
Linked list

tree

queue

stack

WHAT IS THE DIFFERENCE BETWEEN


STACK, QUEUE, ARRAY?
Stack & Queue vs. Array

Arrays are data storage structures while stacks


and queues are specialized DS and used as
programmers tools.

Stack a container that allows push and pop


Queue - a container that allows enqueue and
dequeue
No concern on implementation details.
In an array any item can be accessed, while
in these data structures access is restricted.
They are more abstract than arrays.

STACKS
Allows access to only the last item
inserted.
An item is inserted or removed from the
stack from one end called the top of
the stack.
This mechanism is called Last-In-FirstOut (LIFO).

STACK OPERATIONS
Placing a data item on the top is called
pushing, while removing an item from
the top is called popping it.
push and pop are the primary stack
operations.
Some of the applications are :
microprocessors, some older calculators
etc.

QUEUES
Queue is an ADT data structure similar to stack, except that
the first item to be inserted is the first one to be removed.
This mechanism is called First-In-First-Out (FIFO).
Placing an item in a queue is called insertion or enqueue,
which is done at the end of the queue called rear.
Removing an item from a queue is called deletion or
dequeue, which is done at the other end of the queue
called front.
Some of the applications are : printer queue, keystroke
queue, etc.

VARIOUS QUEUES
Normal queue (FIFO)
Circular Queue (Normal Queue)
Double-ended Queue (Deque)
Priority Queue

CIRCULAR QUEUE
When a new item is inserted at the rear, the
pointer to rear moves upwards.
Similarly, when an item is deleted from the
queue the front arrow moves downwards.
After a few insert and delete operations the
rear might reach the end of the queue and
no more items can be inserted although the
items from the front of the queue have been
deleted and there is space in the queue.

CIRCULAR QUEUE
To solve this problem, queues implement
wrapping around. Such queues are called
Circular Queues.
Both the front and the rear pointers wrap
around to the beginning of the array.
It is also called as Ring buffer.
Items can inserted and deleted from a queue
in O(1) time.

DEQUE
It is a double-ended queue.
Items can be inserted and deleted from
either ends.
More versatile data structure than stack
or queue.
E.g. policy-based application (e.g. low
priority go to the end, high go to the
front)

PRIORITY QUEUES
More specialized data structure.
Similar to Queue, having front and rear.
Items are removed from the front.
Items are ordered by key value so that
the item with the lowest key (or
highest) is always at the front.
Items are inserted in proper position to
maintain the order.
Lets discuss complexity

ARRAYS
An array is an indexed set of variable. It is like
a set of boxes that hold things.
A list is a set of items.
An array is a set of variables that each store
an item.

THANK YOU

You might also like