Questions tagged [deque]

A double-ended queue. Container datatype which is typically supporting efficient insertion and removal from two ends.

878 questions
-2
votes
2 answers

Dequeue class printing address instead of QueueNode item

I'm trying to create a Linked List dequeue class that accepts nodes at the head as well as rear. My method, tailRemove() should remove only the item at the tail of the deque. However, when I print it, it's printing the address. The toString() method…
srsarkar7
  • 145
  • 3
  • 19
-2
votes
1 answer

Memory fault in C++ program seemingly caused by deque

I am building a small C++ program that needs to use a deque to manage some dynamic data. I built the script and works great when there are small amounts of data put in and taken out of the deque, but when a good amount of data is put in and out the…
chromedude
  • 4,057
  • 15
  • 60
  • 90
-2
votes
3 answers

Is this valid when dereferencing an iterator

for (auto iter = dlQueue.cbegin(); iter != dlQueue.cend(); ++iter) { // reference to the current element in the container if (*iter.id == listid) { *iter.stall =…
TheBlueCat
  • 1,079
  • 3
  • 18
  • 36
-2
votes
1 answer

deque prints back element instead of the front using front()

I am using dque to push some elements that I read from a file to the back of the deque but when I print them from the front I only get the last element fgets(line,100,file); qu.push_back(line); fgets(line,100,file); qu.push_back(line); …
Roola
  • 127
  • 6
-2
votes
2 answers

comparison between pointers

I am implementing a dequeue in c via arrays. left and right are pointers which point to the leftmost and rightmost elements of the dequeue. The show() function recieves the left and right pointers. When i try the following in void show(int *l,int…
ksb
  • 610
  • 8
  • 18
-3
votes
4 answers

Why does a deque constructed from a single list return its item rather than the list itself?

I run the code below: from collections import deque q = deque([('0000',0)]) a = q.popleft() print(a) print(type(a)) b = [('0000',0)] print(b) print(type(b)) And output is: ('0000', 0) [('0000', 0)] I wonder why…
Albert Nguyen
  • 327
  • 1
  • 9
-3
votes
1 answer

Size of nested deques

I want to get the size of a nested deque, like this one: typedef struct{ deque vec1; deque vec2; deque vec3; }struct_deques; deque nestedVecs; However, when I want to access the size of the first deque, after…
Firas94
  • 1
  • 1
-3
votes
1 answer

deque implementation details

I am reading article about the implementation of deque(Deques) Here is the corresponding code: template class deque { public: ⋮ private: size_type theSize; T** blockmap; size_type mapSize; …
Vardan Hovhannisyan
  • 1,039
  • 3
  • 14
  • 36
-3
votes
2 answers

Dynamic allocation and random access: Raw, Smart, Deque, Vector. Why raw so fast, and deque so slow?

I created a little performance test comparing the setup and access times of three popular techniques for dynamic allocation: raw pointer, std::unique_ptr, and a std::deque. EDIT: per @NathanOliver's, added std::vector: EDIT 2: per latedeveloper's,…
kmiklas
  • 11,204
  • 17
  • 55
  • 84
-3
votes
1 answer

How to define Dequeue methods to add and remove elements from rear and front?

Here is my code where I'm attempting to create code for methods that will act as the deque in java I have the methods as follows: void deque(); void addFront(); void addRear(); void RemoveFront(); void RemoveRear(); void isempty(); void…
-3
votes
1 answer

Creating my own Deque Interface and Deque Class

So I've created a Deque interface, but I'm not sure how I go about instantiating my Deque, I thought to use ArrayDeque, but I believe that ArrayDeque is another Interface, and I'm trying to use my own Interface. public interface DequeInterface { …
Aman Kakkar
  • 51
  • 1
  • 8
-3
votes
1 answer

Confusing syntax of deque. What does this syntax mean?

I have a C++ code for deque which declares the deque and I do not understand what it means? deque pile[7]; The above deque used is from standard library implementation of C++ I did an extensive research on it but no body has used it this way.…
-3
votes
2 answers

Include deque in C

I have troubles to include deque in my C code. I thought that deque should be a standard library, but when I am trying to include it with #include the compiler's answer is: No such file or directory. I was searching for header in files given…
Zuz
  • 9
  • 2
-3
votes
3 answers

Push back numbers in a deque in c++

I've got a deque in c++ and I want to push back to it numbers from 1 to 17. I wrote the following code: string Result; string Result; ostringstream convert; for(int i=1; i< 18; i++){ convert >> i; Result =…
snake plissken
  • 2,489
  • 9
  • 37
  • 61
-4
votes
1 answer

What are the possible applications of deque functions in real time use?

Help me learn with the application of real time use of deque functions from collection library, if possible try adding some examples to it . Thank You.
1 2 3
58
59