O'Reilly logo

Learn C the Hard Way: A Clear & Direct Introduction To Modern C Programming by Zed A. Shaw

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exercise 42. Stacks and Queues

At this point in the book, you should know most of the data structures that are used to build all of the other data structures. If you have some kind of List, DArray, Hashmap, and Tree, then you can build almost anything else out there. Everything else you run into either uses these or some variant of these. If it doesn’t, then it’s most likely an exotic data structure that you probably won’t need.

Stacks and Queues are very simple data structures that are really variants of the List data structure. All they do is use a List with a discipline or convention that says you always place elements on one end of the List. For a Stack, you always push and pop. For a Queue, you always shift to the front, but pop from the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required