Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

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.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9200805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T22:50:57+00:00 2026-06-17T22:50:57+00:00

I am using push_front() and push_back() only. Thus, I do not incur any other

  • 0

I am using push_front() and push_back() only. Thus, I do not incur any other cost of using insert() or remove().

I know both containers offer O(1) complexity for each of these functions, deques having amortized constant time compared to lists having constant time.

But I want to know which time is less than the other, if there is, at all.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T22:50:58+00:00Added an answer on June 17, 2026 at 10:50 pm

    Not sure how to answer your question. You seem to want us to write a benchmark program that you could easily write yourself. So instead of doing that, I’ll just state this:

    • With a list, every item you push will incur a memory allocation.
    • With a deque, large blocks are allocated at once.

    Given that memory allocation is normally slow, I would expect the deque to out-perform list.

    If you push or pop many items at once, this will be especially true, as cache locality comes into play.

    Of course, you could write an allocator on the list to use a memory pool. Then you might get better performance.

    So with these hypotheses in mind, go away and measure it, and if you want to discuss the results, that would be the time to ask a question.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

im using simple vector push_back to object of Type A and getting this error
I'm using camera like it was described here: Android Camera will not work. startPreview
All the documentation I can find on the STL containers (both queue and list)
Possible Duplicate: Cost of using std::map with std::string keys vs int keys? if I
I am using push notifications module. One of my friend did an app for
I've been wondering if there is a real advantage to using COMET / push-technologies
Im using restkit and push notifications and I have also built the interface, so
I'm trying to setup the application server part of C2DM push messaging using this
I push a fragment on the fragment stack using the following code: FragmentManager fragmentManager
I am doing push notification for android using C2DM. it works well. but while

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.