-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDeque.hpp
More file actions
23 lines (20 loc) · 765 Bytes
/
Deque.hpp
File metadata and controls
23 lines (20 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef DEQUE_H
#define DEQUE_H
#include "DLinkedList.hpp"
// Class of a linked deque
class Deque{
public:
int size() const; // Return number of elements in the deque
bool isEmpty() const; // Check if the deque is empty or not
const Elem& front(); // Return first element of the deque
const Elem& back(); // Return last element of the deque
void insertFront(const Elem& element); // Insert new first element
void insertBack(const Elem& element); // Insert new last element
void removeFront(); // Remove first element
void removeBack(); // Remove last element
private:
DLinkedList DList; // Doubly linked list of elements
int n = 0; // Count for the number of elements in the deque
friend class NotationConverter;
};
#endif