Advertisement
sajid161

12:4

Jan 9th, 2021
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.69 KB | None | 0 0
  1. void push_back_pb(deque<int> &dq, int x){
  2.    
  3.     dq.push_back(x);
  4.    
  5. }
  6.  
  7. /* Function to pop element from back
  8. * dq : dqueue From which element is to be popped
  9. */
  10. void pop_back_ppb(deque<int> &dq){
  11.    
  12.     if(!dq.empty())
  13.      dq.pop_back();
  14.     else
  15.     return;
  16.    
  17. }
  18.  
  19. /* Function to return element from front
  20. * dq : dqueue from which element is to be returned
  21. */
  22. int front_dq(deque<int> &dq){
  23.    
  24. if(!dq.empty())
  25.     return dq.front();
  26.     else
  27.     return -1;
  28.    
  29. }
  30.  
  31. /* Function to push element to front
  32. * dq : dqueue in which element is to be pushed
  33. * x : element to be pushed
  34. */
  35. void push_front_pf(deque<int> &dq, int x){
  36.    
  37.     dq.push_front(x);
  38.    
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement