Unit I
Unit I
Dr.K.Kanagaraj
AP(Sr.G)/MCA
Definition
a program.
Integer
Floating point number
Character
Constants
String constants
Pointers
Non Primitive Data Structure
• The Data structures that are derived from the
primitive data structures are called Non
primitive data structure.
Traversing
Searching
Insertion
Deletion
Sorting
Merging
Traversing Arrays
• Traversing: It is used to access each
data item exactly once so that it can be
processed.
Insertion into Array
• Insertion: It is used to add a new data
item in the given collection of data
items.
Deletion from Array
• Deletion: It is used to delete an existing
data item from the given collection of
data items.
Searching in Arrays
• Searching: It is used to find out the
location of the data item if it exists in
the given collection of data items.
Linear Search
Binary Search
Linear Search
Binary Search
The binary search algorithm can be used with
only sorted list of elements.
peek( ): It returns the top item from the stack but does
not remove it.
Postfix
Infix Expression Prefix Expression Expression
A+B*C+D ++A*BCD ABC*+D+
(A + B) * (C + D) *+AB+CD AB+CD+*
Simple Queue
Circular Queue
Priority Queue
front rear
struct Node
{
int info;
struct Node *link;
}*node1, node2;
Creating a linked list
info is the information field and link is the link
field.
printList(head)
Insert a new node to the front
new_node->data = new_data;