C++ Stack and Queue Tutorial for Beginners

In summary, there are many C++ tutorial videos on the internet, but they are not as effective as textbooks.
  • #1
sukalp
53
2
is there any tutorial which covers stack and queue in c++.
i am not able to understand it is getting difficult for me .
 
Technology news on Phys.org
  • #4
Just put ' C++ queue video ' and ' C++ stack video ' into Google . My search generated many results .

Personal observation : I have always found learning things from textbooks and textbook style websites far easier and certainly more reliable than trying to learn anything from video tutorials .
 
  • #5
Nidum said:
Just put ' C++ queue video ' and ' C++ stack video ' into Google . My search generated many results .

Personal observation : I have always found learning things from textbooks and textbook style websites far easier and certainly more reliable than trying to learn anything from video tutorials .
thank you
 
  • #6
The problem with video tutorials is seeing the code being executed and then trying to use the code means stopping the video and typing in what you see or jumping to some URL the video might reference to get the code.
 
  • Like
Likes sukalp
  • #7
jedishrfu said:
The problem with video tutorials is seeing the code being executed and then trying to use the code means stopping the video and typing in what you see or jumping to some URL the video might reference to get the code.
thank you
 
  • #8
sukalp said:
is there any tutorial which covers stack and queue in c++.
i am not able to understand it is getting difficult for me .

Definitely agree with Nidum and jedishrfu about video tutorials. I also highly recommend more thorough reading from a textbook. Robert Sedgewick's "Algorithms in C++" https://www.amazon.com/dp/0201350882/?tag=pfamazon01-20, is a great resource.
 
Last edited by a moderator:
  • #9
Not to flog a dead horse here...
But textbooks is the way to go. What worked best for me was to take the examples from the books. Run them as described, see how they run. Then tinker with the code, change things and see the result.
But you'll need to find your own way to learn :)
 
  • #10
QuantumQuest said:
Definitely agree with Nidum and jedishrfu about video tutorials. I also highly recommend more thorough reading from a textbook. Robert Sedgewick's "Algorithms in C++" https://www.amazon.com/dp/0201350882/?tag=pfamazon01-20, is a great resource.
thanks
 
Last edited by a moderator:
  • #11
cpscdave said:
Not to flog a dead horse here...
But textbooks is the way to go. What worked best for me was to take the examples from the books. Run them as described, see how they run. Then tinker with the code, change things and see the result.
But you'll need to find your own way to learn :)
thanks
 

What is a stack in C++?

A stack in C++ is a linear data structure that follows the Last In First Out (LIFO) principle. This means that the last element inserted into the stack is the first one to be removed. It is a collection of elements that are added or removed from only one end, known as the top of the stack.

What is a queue in C++?

A queue in C++ is a linear data structure that follows the First In First Out (FIFO) principle. This means that the first element inserted into the queue is the first one to be removed. It is a collection of elements that are added to the back and removed from the front.

How do you implement a stack in C++?

A stack in C++ can be implemented using an array or a linked list. In the array implementation, a fixed size array is used to store the elements, and a variable keeps track of the top element. In the linked list implementation, each element is represented as a node and a pointer points to the top node of the stack.

How do you implement a queue in C++?

A queue in C++ can be implemented using an array or a linked list. In the array implementation, a fixed size array is used to store the elements, and two variables keep track of the front and rear elements. In the linked list implementation, each element is represented as a node and two pointers point to the front and rear nodes of the queue.

What are the common operations on a stack and queue in C++?

The common operations on a stack include push (add an element to the top of the stack), pop (remove the top element), peek (retrieve the top element without removing it), and isEmpty (check if the stack is empty). For a queue, the common operations include enqueue (add an element to the back of the queue), dequeue (remove the front element), peek (retrieve the front element without removing it), and isEmpty (check if the queue is empty).

Similar threads

  • Programming and Computer Science
2
Replies
69
Views
4K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
2
Views
683
  • Programming and Computer Science
Replies
5
Views
1K
  • Programming and Computer Science
Replies
2
Views
1K
  • Programming and Computer Science
Replies
28
Views
2K
  • Programming and Computer Science
Replies
1
Views
977
  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
4
Views
638
  • Programming and Computer Science
Replies
2
Views
1K
Back
Top