java - Length of Specified Queue -
i correcting 1 of tests , incorrect on 1 question, many of others in class. suppose have declaration:
arraybndqueue<string> q = new arraybndqueue<string>(10);
choose 1 of following describe length of queue.
- a) length is
- b) there not enough information compute length of queue
- c) situation cannot happen
front = 8 rear = 7
we thought enough information queue. if front 8 , 7, thought full queue (of length 10). however, answer incorrect. can explain why, exactly?
queue collection , has size() method returns size. unknown how arraybndqueue implemented jdk queues empty after creation unless accept collection argument @ construction time.
Comments
Post a Comment