Title: Data Structures by Yaman Singhania
1Data Structures
Through C/C
Yaman Singhania
http//www.computercareer.in
2Introduction to Data Structures
- What is DATA STRUCTURE?
- A Data Structure is the way of Organizing the
data for minimizing the use of memory and for the
use of updation or it is arranging the data in
the main memory. In other words, data structures
are used to store the data or acts as a
container. - Data Structures are basically divided into two
parts - 1). Linear Data Structure
- 2). Non-Linear Data Structure
- Linear Data Structure gt
- In Linear Data Structure A Sequence is followed.
- Sequence means every data item will have an
ancestor and a successor. - Example of Linear Data Structures are
- Queue
- Linked List
- Arrays
- Stack
http//www.computercareer.in/
3Introduction to Data Structures
- Non-Linear Data Structures
- In Non-Linear Data Structures, No Sequence but
hierarchy is followed. - Example of Non-Linear Data Structures are
- Tree
- Graph
- Tables
- Sets
- Data Structures stores data of different data
types.What is DataType? - A Datatype is a collection of values in which
operations can be performed. - Three Types of DataType in Data Structures are
- Primitive DataTypes
- Abstract DataTypes (or User-Defined DataTypes)
- Polymorphic DataTypes
- VISIT
OUR PROGRAMMING BLOG
http//www.computercareer.in/
4Introduction to Data Structures
- Primitive DataType Primitive DataTypes are
previously defined by the Developers/Programmers
and cannot be broken further. - For examples int, float, Double, char, etc.
- Abstract DataType Abstract DataTypes are
created by using Primitive DataTypes. - Here the specification of the operations are
separated from representation of the value and
implementation of the operation. - For examples Array, Structure, Constructor etc.
- Polymorphic DataType Polymorphic DataTypes are
independent of the value stored in the list. - To perform Practical Codings ,
- DOWNLOAD TURBO C http//yamanturboc.blogspot.in/
http//www.computercareer.in/
5Common Terms
- Data Data are the Raw Facts and Figures. Data
word is always plural. - Information Processed Data which have some
meaningful values is called information. - Entity Entity is Anything which have certain
property and Attributes. - Domain Domain is Set of Values which the
Attributes can have. - Record Collection of Homogeneous Entities are
Record. - File Collection of Homogeneous Records.
- Key A key is used to uniquely identify the
record. Key is of following types - Primary Key Primary key uniquely identifies the
identify a record in database table. - Unique Key The Unique constraint uniquely identi
fies each record in a database table. The Unique
and Primary Key constraints both provide a
guarantee for uniqueness for a column or set of
columns. A Primary Key constraint automatically
has a Unique constraint defined on it. - Candidate Key A Candidate Key is a set of one
or more fields/columns that can identify a record
uniquely in a table. There can be multiple
Candidate Keys in one table. Each Candidate Key
can work as Primary Key.
Download TURBO C
http//www.computercareer.in/
6Common Terms and Array
- Alternate Key A Alternate key is a key that can
be work as a primary key. Basically it is a
candidate key that currently is not primary key. - Compound Key Composite Key is a combination of
more than one fields/columns of a table. It can
be a Candidate key, Primary key. - Foreign Key A Foreign Key is A Non Key
Attribute whose values are derived from the
Primary Key of Another Table. - Let us Start Learning Data Structures from Linear
Data Structures. - ARRAY -
- Array is a Collection of data items consisting
- Homogeneous DataType.
- Types of Array
- One -Dimentional
- Two -Dimentional
- Multi Dimentional
- http//www.computercareer.in/
7Array
- How to Declare? Visit Our
Programming Blog www.computercareer.in/blog/ - Int a50
- For Input and To print, We Use Loops ( for,
while, do - while, do) . - Write A Program to take Input from User and Print
the Array. - int a5, i
- for( ( i 0 i lt a i i)
-
- printf( Enter 5 numbers in an Array /n )
- scanf(d, a i )
-
- for( i 0 i lt a i i)
-
- printf(d, a i )
-
-
DOWNLOAD TURBO C -
http//www.computercareer.in/
8Array Program s
- Write A Program to Perform Linear Search in An
Array? Download Our TURBO C - Write A Program to Perform Selection Sort in An
Array? to Perform Codings. - Write A Program to Perform Binary Search in An
Array? - Write A Program to Perform Insertion Sort in An
Array? - Write A Program to Perform Bubble Sort in An
Array? - Write A Program to Illustrate Address
Manipulation in 2-D Array? - To Learn Array, It is Necessary to Learn ALL
THESE ARRAY PROGRAMS on Tips. Use Our Turbo C. - include(iostream.hgt
- includeltconio.hgt
- int Lsearch(int ,int,int)int main( )
- For more, and To Learn All the Array
Programs, - Please Visit
http//www.computercareer.in/blog -
OR - Click Here
-
http//www.computercareer.in/
9Stack and Queue
- Stack is A Linear Data Structure in which we can
Insert New Data Delete the existing data at a
point called Top of the Stack. Stack always
follow LIFO (Last in First Out) Rule. - Stack can be represented as Array and Linked
List. - Kindly Visit http//www.computercareer.in/blog
OR Click Here -
http//www.computercareer.in/
10Stack and Queue
- Operations of Stack are
- Push To Insert a new element in the stack, we
use PUSH. - Pop To Delete an existing element from the
stack, we use POP. - IsOverflow To check Whether Stack is full or
not, we use IsOverflow. - IsUnderflow To check Whether Stack is Empty or
not, we use IsUnderflow. - Peek To Access the Top of the element of the
Stack without deleting, we use Peek. - We have Various Algorithms for these Operations
to make you clear better the concept of Stack.To
Learn those Algorithms, - Visit http//www.computercareer.in/blog OR
Click Here - Download CTurbo Click Here
-
http//www.computercareer.in/
11Applications of Stack and Queue
- Applications of Stack Are
- Infix to Postfix
- Postfix to Infix
- Infix to Prefix
- Prefix to Infix
- Queue
- Queue is a Linear Data Structure in which we can
Insert - and Delete items from Opposite ends.
- There are two ends front and rear. If we are
inserting element from front and we have to
delete element from Rear. - Queue always follows FIFO (First In First Out).
-
http//www.computercareer.in/
12Queue and Stack Programs
- Types of Queues are
- Simple Queue
2. Circular Queue - Priority Queue
4. DeQueue (Doubled-Ended Queue) - Write A Program to Perform Insertion and Deletion
in Circular Queue - Write A Program to Perform Infix to Postfix
Conversion in Stack - Write A C Program for Implementing Queue Using
Stack. - Write A Program to Perform Pushing in Stack.
- For Solutions , Visit http//www.computercareer.
in/blog - We have Working Solutions of these Programs and
We keep on adding something New to Our Blog..So
Dont forget to check out Website Daily and Be
Regular! )
http//www.computercareer.in/
13Linked List
- A Linked List is a data structure consisting of a
group of nodes which together represent a
sequence. - Types of Linked Lists
- Singly Linked List Singly linked lists contain
nodes which have a data field as well as
a next field, which points to the next node in
line of nodes. - Doubly Linked List In a doubly linked list,
each node contains, besides the next-node link, a
second link field pointing to the previous node
in the sequence. The two links may be
called forward(s) and backwards, - Circular Linked List In Circular Linked List,
First Node contains the address of the Last Node.
http//www.computercareer.in/
14Operations in Linked List and Programs
- Insertion in Linked List can be done by three
ways - Insertion At Beginning
- Insertion At End
- Insertion At Specified Position
- Deletion in Linked List can be done by three ways
- Deletion from Beginning
- Deletion from End
- Deletion from Specified Position
- Write A Program to Insert an Element at Beginning
in Linked List. - Write A Program to Delete an Element from
Beginning in Linked List. - For the Solutions of there Programs,
- Kindly Visit http//www.computercareer.in/blog
or Click Here
http//www.computercareer.in/
15Tree
- A Tree is a Non-linear data structure made up of
nodes or vertices and edges without having any
cycle. The tree with no nodes is called
the Null or Empty tree. A tree that is not empty
consists of a root node and potentially many
levels of additional nodes that form a hierarchy. - Binary Tree - A binary tree is one in which each
- node has at most two descendants. A node
- can have just one but it cant have more than
two. - Insertion in Binary Search Trees
- To insert any element in Binary Search Tree, we
have - to compare with the root of node. If found
Greater, - then insert at Right of root node. If found
Smaller, then - Insert at left of root node.
http//www.computercareer.in/
16Tree
- Deletion from A Binary Tree
- There are four possible cases that we need to
consider - No node in the Tree contains specified Data.
- Node containing the data has no children.
- Node containing the data has exactly one child.
- Node containing the data has two children.
- Kindly Check Our Blog for Programs related to
Tree Data Structure. - http//www.computercareer.in/blog
-
http//www.computercareer.in/
17Graph
- A Non-Linear Data Structure that consist of a set
of nodes called Vertexes and a set of edges that
relate the nodes to each other is called Graph. - Type of Graph
- Directed Graph When Edges in a Graph have A
Direction, the graph is called Diagraph or
Directed Graph. - UnDirected Graph When Edges in a Graph has no
direction, the graph is called UnDirected Graph. - Graphs can be represented as array, linked lists
and queues. - Check Our blog, http//www.computercareer.in/blog
http//www.computercareer.in/
18Thanks
Yaman Singhania
For Watching
Visit http//www.computercareer.in http//www.fa
cebook.com/Ysinghania500