this is my latest class assignment, i would really appreciate some assistence with my pseudo code to help me in the right direction. my code skeleton is provided at the end of this post. Deque A double-ended queue, often abbreviated deque and pronounced deck, is an object with the following interface. public interface IDeque<E> { public void addFirst(E e); public void addLast(E e); public E removeFirst(); public E getFirst(); public boolean isEmpty(); } A deque is a list of items with restrictions on how it can be manipulated. Items can be added to either end of the list but can …

Member Avatar
Member Avatar
+0 forum 5

Python's double ended queue module makes Caesar's cipher easy.

Member Avatar
Member Avatar
+1 forum 1

#include <memory> #include <deque> void MyFunc { std::deque< std::shared_ptr< Sprite* > > SpriteList; func_to_fill_deque( SpriteList ); for( auto i = SpriteList.begin(), end = SpriteList.end(); i != end; i++ ) { SpriteList[ i ]->spriteFunc(); // doesn't work SpriteList.at( i )->spriteFunc(); // also doesn't work } } void func_to_fill_deque( std::deque< std::shared_ptr< Sprite* > >& list ) { ptr = new Sprite( filename ); list.push_back( std::make_shared< Sprite* >( ptr ) ); } When I try SpriteList[ i ] I get a red squiggle under the first '[' with the msg "No operator matches these operands" Trying SpriteList.at( i ) gives a red squiggle …

Member Avatar
Member Avatar
+0 forum 2

// This program uses the a queue template to create a queue of strings. #include <iomanip> #include <iostream> #include <cstdlib> using namespace std; // // TO CREATE A "template" class named "T" template <class T> // // TO CREATE A CLASS NAMED "Dynque" class Dynque { private: struct QueueNode { T value; QueueNode *next; QueueNode(T val, QueueNode *nextp = NULL) { value = val; next = nextp; } }; QueueNode *front; QueueNode *rear; int numItems; public: Dynque(); ~Dynque(); // // FUNCTION PROTOTYPE FOR "engueue" // THE FUNCTION DOES NOT RETURN DATA // THE PARAMETER LIST CONTAINS "T" void enqueue(T); // …

Member Avatar
Member Avatar
+0 forum 2

I am using Python 2.6 with ide and i created a list with names `names = 'mark', 'raymond', 'rachel', 'matthew', 'roger', 'judith', 'charlie', 'melissa', 'betty']` and then set `names = nmls` so even if I update names, nmls gets updated... however if I do `names = deque(['raymond', 'rachel', 'matthew', 'roger', 'judith', 'charlie', 'melissa', 'betty'])` and then nmls gives the old list not the new names... how is this happening ?

Member Avatar
Member Avatar
+0 forum 7

I'm writing a deque implementation with ArrayList as required by my instructor. So far the body of the class looks like this [code=java] try { while (!endOfFile) { character = inputFile.readChar(); while (!character.equals('\u0003')) { if (character.equals('\u0008')) deck.removeBack(); else deck.addToBack(character); } } while (!deck.isEmpty()) { character = deck.removeFront(); if (character.equals('\u0003')) System.out.print("\n"); else System.out.print(character); } } catch (EOFException e) { endOfFile = true; } [/code] The deque is initialized as [code=java] Deque<Character> = new deck Deque<Character>() [/code] I've tested my Deque with a separate test class and I'm quite sure that it's working properly. But every time I try to run this …

Member Avatar
Member Avatar
+0 forum 7

Hello World! I'm new in the forum and I don't have too much experience with C++, I'm looking for help with my code, I hope you could help me :) I have to read from a file.txt different collumns, each of them corresponds to a parameter and store them in a deque, I have found out how to read the first 3, but the problem comes with the last parameter, because is a vector that I have insert in the deque, let me show you: My file would be something like this: 1 A0003 128 4,4,4 2 A0005 128 1,8,3,2 …

Member Avatar
Member Avatar
+0 forum 1

Can Someone tell me why these files won't compile on unix but work fine (mostly) in windows? It looks like unix-land doesn't load the variables from the inherited class QueueArray into the proper scope. prog5.cpp is supposed to create 3 different types of Deque classes. each Deque inherits from ArrayQueue Your help is greatly appreciated =) Thanks everyone

Member Avatar
Member Avatar
+0 forum 5

The End.