Sem 3 DS
Sem 3 DS
DS
-Primitive(basic)
=> int, char, float
-Non Primitive(derived)
-Linear(using either sequential memory location or links)
=> arrays, linked lists, stacks, queues
-Non Linear(hierarchical and no adjacency relationship)
=> trees, graphs
insert(ele, index)
delete(ele)
Linked List contains a START pointer which stores addr of 1st node.
the NEXT pointer stores addr of next node.
for last node NEXT pointer contains NULL
the AVAIL pointer stores addr of first free space in free pool
Garbage Collection - collecting all unused cells and adding their addr to the free
pool
Infix to Postfix
----------------
Array - Operand
Stack - Operator
Higher priority operators can be placed above Lower priority operators
Postfix Evaluation
------------------
Stack - Operand
Circular queue
Insertion - rear pointer position
rear = (rear+1)%max_size
Queue[rear]
Deletion - front pointer position
Value = Queue[front]
front = (front+1)%max_size
void inorder(Tree T)
{
if(T!=NULL)
{
inorder(T->left);
printf(T->data); //root
inorder(T->right);
}
}