CS 225 Lecture Notes - Lecture 18: Time Complexity, Iterator, Linked List

17 views4 pages

Document Summary

Queue array based implementation: template class queue { public: Queue(); ~queue(); // etc. bool empty() const; void enqueue(const sit & e); // entry is d// m is exit exit rig^ht here now. // we could reposition entry to the beggining of the array instead, this way we use unused spaces. // the reason exit is in the middle of the array is to keep track of what needs to be kept and removed, this way the next thing to remove is the exit, m. // this method will wrap around the array. // everytime you increment the array indicies is done mod array capacity. , to make sure it"s within the range of the array or to increment properly, good thing to check when we also double size enqueue(m); enqueue(o); enqueue(y); enqueue(i); Cs 225 - lecture page 1 enqueue(o); enqueue(n); enqeueue(d); enqueue(a); enqueue(i); enqueue(s); dequeue(); enqeueue(h); enqeueue(a);

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents