How to check full & empty?
How to resize?
- Create a new array
- Iterate the item in the origin array
- Assign the new array to the old one
How to iterate?
- Initialization: begin at head
iterator = (iterator + 1) % array.length
iterator != last + 1
How to add?
- Check if is full, if so, double its size
last = (last + 1) % array.length
- Place the item into the new last index position
How to remove?
- Generate a random integer within the range [0, Size)
- Turn it to the index
randomInt + head
- Swap the item of that index with the head