Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using DataStructures.LinkedList;
  7.  
  8. namespace DataStructures.Queue
  9. {
  10. public class Queue<T>
  11. {
  12. public int Count
  13. {
  14. get { return this.Elements.Count; }
  15. }
  16.  
  17. private GenericLinkedList<T> _elements;
  18. public GenericLinkedList<T> Elements
  19. {
  20. get { return _elements; }
  21. set { _elements = value; }
  22. }
  23.  
  24. public Queue()
  25. {
  26. this.Elements = new GenericLinkedList<T>();
  27. }
  28.  
  29. public bool isEmpty()
  30. {
  31. return this.Count == 0;
  32. }
  33.  
  34. public void Enqueue(T newElement)
  35. {
  36. this.Elements.Push_Back(newElement);
  37. }
  38.  
  39. public T Dequeue()
  40. {
  41. return this.Elements.Pop_Front();
  42. }
  43.  
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement