Data structure queue confusion -


i'm practising data structures @ moment, came across question @ 1 of online tests taking , confused me. can clarify me because couldn't answer , started hesitating knowledge.

question:

assume underpinning data structure implementation of queues array. how guarantee empty queue (array) not taken mistakenly full one.

if implement queue using array queue's max size size of array, can't tell if queue empty or full using size of array cause static, need keep counter increases or decreases depending if add or remove elements queue, when counter equal length of array queue if full, validate if queue empty when positions in array null, that'll consume more time having counter, guess know me seems question referring that.


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -