Thread: deque

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    deque

    Hello everyone,


    I want to learn more about deque, and previously I only have basic concept and samples about deque as a double-ended queue.

    My questions are,

    1. How it is implemented internally for the performance optimization for get front and end elements? Elements are stored in an array or linked list or?
    2. Are there any documents about how to use deque effectively and efficiently (i.e. good patterns and anti-patterns of deque)? I have searched MSDN and Google and only found some sample samples. Any experience sharing or recommended articles?


    thanks in advance,
    George

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    This has been answered elsewhere.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Algorithm Dissector iMalc's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    6,318
    Quote Originally Posted by George2 View Post
    Hello everyone,


    I want to learn more about deque, and previously I only have basic concept and samples about deque as a double-ended queue.

    My questions are,

    1. How it is implemented internally for the performance optimization for get front and end elements? Elements are stored in an array or linked list or?
    2. Are there any documents about how to use deque effectively and efficiently (i.e. good patterns and anti-patterns of deque)? I have searched MSDN and Google and only found some sample samples. Any experience sharing or recommended articles?


    thanks in advance,
    George
    There are dozens of ways of implementing a deque. List, vector, vector of vectors etc etc.
    My homepage
    Advice: Take only as directed - If symptoms persist, please see your debugger

    Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks iMalc,


    Quote Originally Posted by iMalc View Post
    There are dozens of ways of implementing a deque. List, vector, vector of vectors etc etc.
    What is your understanding of the statements from The C++ Standard Library book when compare vector with deque? Why one more indirection level?

    --------------------
    The internal structure has one more indirection to access the elements, so element access and iterator movement of deques are usually a bit slower.
    --------------------


    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. deque best practices
    By George2 in forum C++ Programming
    Replies: 10
    Last Post: 03-02-2008, 08:11 PM
  2. Using DEQUE within Class Definition
    By wbeasl in forum C++ Programming
    Replies: 8
    Last Post: 10-07-2007, 09:50 AM
  3. Confusion with a Deque program
    By Bluefish in forum C++ Programming
    Replies: 0
    Last Post: 05-20-2006, 03:13 PM
  4. costum grow() not working
    By Opel_Corsa in forum C++ Programming
    Replies: 2
    Last Post: 02-17-2006, 10:11 PM
  5. Very slow processing of vectors?
    By Blackroot in forum C++ Programming
    Replies: 35
    Last Post: 02-06-2006, 06:36 PM