DSimput 1
DSimput 1
Elements:
A Stack contains elements of the same type arranged in sequential order. All operations take place at a single end
that is top of the stack.
Operations:
push() – Insert an element at one end of the stack called top.
pop() – Remove and return the element at the top of the stack, if it is not empty.
peek() – Return the element at the top of the stack without removing it, if the stack is not empty.
size() – Return the number of elements in the stack.
isEmpty() – Return true if the stack is empty, otherwise return false.
isFull() – Return true if the stack is full, otherwise return false.
5.what is linked list and explain different types of Linked List with examples?
Linked list is a collection of elements called nodes.Each node contains two parts. They are data
part and link part.
if (front == NULL) {
print("Queue is empty");
}
else
{
while (temp != rear)
{
printf("%d ", temp->data);
temp = temp->next;
}
}
}