What is the difference between Stack and Queue in C++?
Answer / Anjali Singh
"Stack: A linear data structure that follows Last-In-First-Out (LIFO) principle. Elements are inserted at one end, called the top, and removed from the opposite end. Stacks have constant-time O(1) average complexity for push(), pop() and peek() operations.nnQueue: A linear data structure that follows First-In-First-Out (FIFO) principle. Elements are inserted at one end, called the rear, and removed from the opposite end, called the front. Queues have O(1) average complexity for enqueue() operation and O(n) for dequeue()."n
| Is This Answer Correct ? | 0 Yes | 0 No |
What are the different scope C++ provide ?
How can you force the compiler to not generate them?
what is friend function in C++?
What is an abstract class in C++
1 Answers SwanSoft Technologies,
Find the Factorial of a number using a program.
Write a program to generate the Fibonocci Series in C++.
What does it mean to declare a member function as static in C++?
Define namespace.
Difference between function overloading and function overriding.
What is a memory leak in C++?
What is a class in C++?
2 Answers Amazon, TCS, UGC Corporation,
Tell me about virtual function