Need of Index, Push, Pop Overflow, Enqueue, Dequeue
Q6: What is the need of index in an array?
Ans: Each location of an element in array has a numerical value called index, which is need to identify the element. Set of indexes in an array are consecutive numbers.
Q7: With the help of sketch, Define push, Pop, overflow and Enqueue, dequeue.
Push and Pop:
Push operation refers to inserting an element in the stack.
Pop operation refers to the removal of an element.
Overflow:
An overflow error occurs when one attempts to access the example array using an index value greater than 9. An underflow error occurs when one attempts to access the example array using an index value less than 0.
Enqueue and dequeue:
Enqueue and dequeue tend to be operations on a queue, a data structure that does exactly what it sounds like it does.
• enqueue() − add (store) an item to the queue.
• dequeue() − remove (access) an item from the queue.
Comments
Post a Comment