150 likes | 402 Views
Queue ADT: circular array implementation. t. h. Queue ADT: circular array implementation. enqueue(‘A’). h. A. t. Queue ADT: circular array implementation. enqueue(‘D’). h. A. D. t. Queue ADT: circular array implementation. enqueue(‘T’). h. A. D. T. t.
E N D
t h Queue ADT: circular array implementation enqueue(‘A’)
h A t Queue ADT: circular array implementation enqueue(‘D’)
h A D t Queue ADT: circular array implementation enqueue(‘T’)
h A D T t Queue ADT: circular array implementation enqueue(‘E’)
h A D T E t Queue ADT: circular array implementation dequeue()
A h D T E t Queue ADT: circular array implementation dequeue()
A D T h E t Queue ADT: circular array implementation enqueue(‘X’)
A D T h t X E Queue ADT: circular array implementation enqueue(‘A’)
A t D A T h X E Queue ADT: circular array implementation enqueue(‘M’)
t A M D A T h X E Queue ADT: circular array implementation enqueue(‘P’)
t P A M D A T h X E Queue ADT: circular array implementation enqueue(‘L’)
P L t M D A T h X E Queue ADT: circular array implementation enqueue(‘E’)
P L M E A T t h X E Pointing t here will cause problems! When t==h, is queue empty or full? Our circular array must be 1 cell larger than the # of values it’s expected to contain at any given time.