Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int front,back;
- front = back = -1;
- void Enqueue(int n){
- arr[++back] = n;
- if(front == -1)front++;
- }
- int Dequeue(){
- if(front == -1){
- printf("Queue is empty");
- return -1;
- }
- int x = arr[front];
- if(front == back){
- front = back = -1;
- }
- front++;
- return x;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement