enqueue and dequeue operations
Enqueue : a new data element is added at the rear end We can use <queue>.append(<item>) Dequeue: data element is removed from front end We can use <queue>.pop(0)
Enqueue : a new data element is added at the rear end We can use <queue>.append(<item>) Dequeue: data element is removed from front end We can use <queue>.pop(0)
Input/output restricted queues are two variations of deque. Input restricted deque- it allows insertion at only one end but allows deletion at both end of the list Output restricted deque – it allows deletions at only one end of the list but allows insertions at both ends of the list
Queue Deque Data elements can be either inserted or deleted at one end Data elements can be inserted or deleted from both the ends We can not reuse memory space once element is deleted from it We can reuse memory space of deleted element for new element to be inserted
Linear Queue Circular Queue Data elements are stored in linear patter Data elements are stored in circular pattern where rear end is connected with front end It occupies more memory space It occupies less memory space Insertion and deletion of elements are possible from rear and front end only Insertion and deletion of element are …
Stack and Queue Queue – simulates queue of people waiting for their turn in FIFO manner Stack – simulates blankets being given in LIFO manner
– Queue is a linear data structure– It stores data in FIFO (First In First Out) manner– Data elements are added at rear end and deleted from front endQueue allow following operation:– Enqueue : a new data element is added at the rear end– Dequeue: data element is removed from front end– Peek : viewing …
– Stack is a linear data structure.– It stores data in LIFO (Last in First Out) manner.– Insertion and Deletion take place at one end.Stack allows following operations:– Push- new data element is added at the top of stack– Pop- data element is removed from the top of the stack– Peek- displaying topmost element of …
Linear data structure– Data elements are stored in a sequence– Each data element is connected to next or previous adjacent element– Exp- stack, queue, linked listNon-linear data structure– Data elements are distributed over a plane– Data elements are connected in hierarchical manner.– Exp-Tree
Yes data structure is related to data type. Following are the reasons-– Data type ensure which type of data a data structure will contain– Data type ensure the type of operations can be performed on data structure– Data type determines the size of data structure in terms of memory.
– Data structure is way of organizing, managing, process data in efficient manner.– Data Structure is physical implementation of data.– Data structure helps processor to process and handle large and complex data without any failure.– Data structure allows running a program or implementing operation at minimum time.– Data structure allows to minimum memory space to …
What is data structure? Name some common data structure Read More »