STACKS AND QUEUE IN DSA
DetailsComments
Details

A stack is a container of objects that are inserted and removed according to the last-in-first-out (LIFO) principle. In the pushdown stacks only two operations are allowed: push the item into the stack, and pop the item out of the stack. A stack is a limited access data structure - elements can be added and removed from the stack only at the top. push adds an item to the top of the stack, pop removes the item from the top. A helpful analogy is to think of a stack of books; you can remove only the top book, also you can add a new book on the top.

A queue is a container of objects (a linear collection) that are inserted and removed according to the first-in-first-out (FIFO) principle. An excellent example of a queue is a line of students in the food court of the UC. New additions to a line are made to the back of the queue, while removal (or serving) happens in the front. In the queue, only two operations are allowed en queue and de queue. Enqueue means to insert an item into the back of the queue, dequeue means removing the front item. The picture demonstrates the FIFO access.

The difference between stacks and queues is in removing. In a stack we remove the item the most recently added; in a queue, we remove the item the least recently added.

Name of the Speaker: Jwala Chorasiya

About the Speaker: Intern/Educator at CodeChef | 4⭐ @CodeChef | MERN STACK| University Leader at Community Classroom

In this session, the speaker will take you through the journey inside out of stack and queue.

For more insights, attend the event and join the community!!

Support the community: commudle.com/communities/cdn-data-structures-and-algorithms

Comments
Jwala Chaurasiya

Jwala Chaurasiya

Jul 22nd 2022, 3:03 PM

else{ string name;cin>>name; if(ch==0)continue; if(stack.empty() || stack.back().first.exercise>=ch){ Book b(ch,name); stack.push_back({b,0}); }else{ stack.back().second
Jwala Chaurasiya

Jwala Chaurasiya

Jul 22nd 2022, 3:03 PM

int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); solution(); return 0; }
Ronit Kamte

Ronit Kamte

Jul 22nd 2022, 3:03 PM

Ok this was a difficult question
Naman Mishra

Naman Mishra

Jul 22nd 2022, 3:04 PM

thank you sir
Natasha Sharma

Natasha Sharma

Jul 22nd 2022, 3:04 PM

thanks
Revati Pahwa

Revati Pahwa

Jul 22nd 2022, 3:04 PM

it was nice sir
Shreenn sahaey

Shreenn sahaey

Jul 22nd 2022, 3:05 PM

it was good sir
Ronit Kamte

Ronit Kamte

Jul 22nd 2022, 3:05 PM

yes sir
Jwala Chaurasiya

Jwala Chaurasiya

Jul 22nd 2022, 3:05 PM

https://www.linkedin.com/in/jwala-chorasiya-34048b1b2/
Ronit Kamte

Ronit Kamte

Jul 22nd 2022, 3:05 PM

ok sir i will connect
Friday, 22nd Jul, 2022

7:30 PM - 8:30 PM IST

online

harsh rana
027_Himanshi Kataria
Anmol
riasingh1510
Ayushi Rana
Ranjeet saw
Abhay Pandey

 ... + 24 More


Click here to view event session