Showing posts with label Data Structure. Show all posts
Showing posts with label Data Structure. Show all posts

Memory Representation/Array Representation of Stack




Memory Representation/Array Representation of Stack :-
Stacks are abstract data types. They are implemented either by an array or by a linked list. In array representation a pointer or variable TOP is used to keep track of the stack. TOP is incremented when items are inserted into stack. It is decremented when items are removed from the stack. A variable N is used to store the maximum number of elements in the stack.

representation,memory,memory representation,array memory representation,memory representation of array,memory representation of array in hindi,array representation in memory
Fig - Memory/Array Representation of Stack


Array Representation / Memory Representation of Queue



Array Representation / Memory Representation of Queue :-
Queue are abstract  data types. They are implemented either by an array or linked list. In array representation, in queue to pointers or variables front and rear are used to track the front rear of a queue. Initially all the elements of a queue are incised to (-1) to indicate an empty queue. When ever an item is inserted in the queue the rear variable or pointer is incremented by (1) to indicate the next empty cell.
When ever the item is deleted from the queue front variable or pointer is incremented by (1) to indicate the new front of the queue.

array representation of queue,array and linked list representation of queue,explain array representation of queue,array representation of queue data structure,memory representation of array,representation of queue as an array,memory representation of array in hindi
Fig - Array/Memory Representation of Queue

What is Queue ?



Queue :-
A queue is an abstract data type , is declares  two methods –
QINSERT and QDELETE.
Queues are implemented either by an array or linked list. The QINSERT operation allows us to insert data at the end of an array or linked list. The QDELETE operation allows us to remove data from the beginning of an array or linked list. Due to this behavior of QINSERT and QDELETE operations, a queue is called a first in first out (FIFO) system.

Basic Operation of Stack


Basic Operation of Stack :-
Initially all the elements of the stack are initialized to (-1), Which indicates an empty stack. The TOP variable is also initialized to (-1). At each insertion , the TOP is incremented by (1) to point to the latest stack TOP. At each deletion the TOP is decremented by (1) and the position from where the item is removed each assign to (-1) to indicate an empty cell.

Here the stack array s[ ], pointer TOP are declared globally. 


What is Stack ?




Stack :-
A stack is an abstract data type, Which declares two methods PUSH and POP.
Stacks are implemented either by an array or by a link list. The PUSH operation allows us to insert data at the end of an array or linked list. The POP operation allows us to remove data from the end of an array or link list. Due to this behavior of PUSH and POP operation a stack is called a last in first out (LIFO) system.

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀