Adding 3rd assignment, stacks and queues
This commit is contained in:
25
Stacks&Queues/TQueue.h
Normal file
25
Stacks&Queues/TQueue.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef STACKS_QUEUES_TQUEUE_H
|
||||
#define STACKS_QUEUES_TQUEUE_H
|
||||
|
||||
#define MAX_SIZE (100 * 100)
|
||||
|
||||
|
||||
class TQueue {
|
||||
private:
|
||||
int queue[MAX_SIZE] {};
|
||||
int head = 0;
|
||||
int tail = 0;
|
||||
int count = 0;
|
||||
|
||||
public:
|
||||
TQueue() = default;
|
||||
~TQueue() = default;
|
||||
|
||||
void Enqueue(int item);
|
||||
int Dequeue();
|
||||
[[nodiscard]] int GetTail() const;
|
||||
[[nodiscard]] int Peek() const;
|
||||
[[nodiscard]] bool IsEmpty() const;
|
||||
[[nodiscard]] bool IsFull() const;
|
||||
};
|
||||
#endif //STACKS_QUEUES_TQUEUE_H
|
||||
Reference in New Issue
Block a user