CS 225 Lecture Notes - Lecture 16: Linked List

26 views3 pages

Document Summary

Summary - running times for list functions: insert/remove at front. // not okay below o(n) shift insert at given location: // ptr to node after which new data will appear. O(1) // given an index remove at given location. O(n) shift insert at arbitrary location remove at arbitrary location: Stacks: memory, this is how stack looks like when executing code main() studyhard() mps() plan() code() exams() wingit() Cs 225 - lecture page 1 dogoodwork() plan() code() test() wingit() // let"s load up brackets, load left bracket, if there"s right bracket, match and remove pair ({}()[(()){(())()}[()) 4 5 + 7 2 - * 3 - 6 / Stack adt: template class stack { public: ~stack(); // also copy constructor, assignment op bool empty() const; void push(const sit & e); // we can use a linked list or array. Stack s; s. push(3); s. push(8); s. push(4); s. pop(); s. pop(); s. push(6); s. pop(); s. push(2); s. pop() s. pop()

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