Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
598 B
1
Indexable
// Stack class to represent a stack
class Queue{
    private: 
        vector<int> arr_q;
        int start, end;
    
    public:
        Queue(int n) {
            start = 0; end = 0;
        };

        bool isEmpty(){
            return (end - start == 0);
        }

        void enqueue(int value){
            arr_q.push_back(value);
            ++end;
        }

        int front(){
            return arr_q[start];
        }
    
        void dequeue(){
            start++;
        }

        int size() {
            return end - start;
        }


};