Vinh La Kiến

48 bundles
1 file3 months ago
2

class SimpleDeque

123456789101112131415161718192021222324252627282930
#pragma once #include <string.h> class SimpleDeque { private: int* values; int capacity; int count; public: SimpleDeque() { this->capacity = 10; this->values = new int[this->capacity]; this->count = 0; } void addFront(int value) { if (this->count == this->capacity) { int* newValues = new int[this->capacity * 2]; memcpy(newValues + 1, this->values, this->capacity); newValues[0] = value; delete this->values; this->values = newValues; } else { } count++; } };