MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

DATA STRUCTURES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following data structures allow insertion and deletion from both ends?
A
Stack
B
Double Ended Queue(Deque)
C
Queue
D
Strings
Explanation: 

Detailed explanation-1: -Deque is a data structure allowing insertion and deletion from both ends.

Detailed explanation-2: -Double ended Queue: Double Ended Queue is also a Queue data structure in which the insertion and deletion operations are performed at both the ends (front and rear).

Detailed explanation-3: -Deque (or, Double Ended Queue) Deque can be used both as stack and queue as it allows the insertion and deletion operations on both ends. Deque can be considered as stack because stack follows the LIFO (Last In First Out) principle in which insertion and deletion both can be performed only from one end.

Detailed explanation-4: -The insertion in a linear queue must happen from the rear end and deletion from the front end. But, in deque, you can perform both insertion and deletion operations at both of its ends. That’s why it is called a Double-Ended Queue (Deque).

Detailed explanation-5: -Stack is a linear data structure in which the insertion and deletion operations are performed at only one end. In a stack, adding and removing of elements are performed at single position which is known as “top". That means, new element is added at top of the stack and an element is removed from the top of the stack.

There is 1 question to complete.