I read that The ADT stack can be implemented using
An array
A linked list
The ADT list
But when I’m using the stack I just call stack library. Which of these implementation stack library use?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
std::stackis a container adapter that uses some other container as the underlying storage for the data. That defaults tostd::deque, but you can specify another sequence such asstd::listorstd::vectorif you prefer.The requirements on the underlying container are pretty minimal — if memory serves, it needs to support a
back(),push_back(),pop_back(),size()andswap()(and the last two aren’t really needed unless you usestack::size()orstack::swap(), which probably aren’t all that common).