Interview Question: C++ Kind of Deck

Sample Question #87 (programming – C++)

What’s a deque in C++? What’s its advantage over vector? What’s its disadvantage?

Advertisements
This entry was posted in Sample Qs. Bookmark the permalink.

One Response to Interview Question: C++ Kind of Deck

  1. Brett says:

    ANSWER
     
    The deque template class represents a double-ended queue, where objects can be inserted and removed from both ends. Its advantage over the vector container is inserting and removing items from the ends are much faster with a deque than with a vector. Its disadvantage is random access to elements in the middle is slower than with a vector. 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s