CMPSC 16 Lecture Notes - Lecture 16: Linked List, Abnormal End, Stack Overflow

55 views4 pages
24 Nov 2016
School
Course
Professor

Document Summary

Object-oriented programming (oop) makes using pointers less useful. Use poi(cid:374)ters (cid:373)ostl(cid:455) if (cid:455)ou"re (cid:449)riti(cid:374)g a c++ progra(cid:373) that refere(cid:374)(cid:272)es c li(cid:271)raries or older c programs. Pointers/references useful when passing variables in a function that you want changed outside the function (ie call-by-reference functions) Linear collection of data elements, called nodes, each pointing to the next node by means of a pointer. List elements can easily be inserted or removed without reorganization of the entire structure (unlike arrays) Data items in a linked list do not have to be stored in one large memory block (unlike arrays) You (cid:272)a(cid:374) (cid:271)uild a list of (cid:862)(cid:374)odes(cid:863) (cid:449)hi(cid:272)h are (cid:373)ade up of (cid:448)aria(cid:271)les a(cid:374)d poi(cid:374)ters to (cid:272)reate a (cid:272)hai(cid:374) Addi(cid:374)g/deleti(cid:374)g (cid:374)odes i(cid:374) the li(cid:374)k (cid:272)a(cid:374) (cid:271)e do(cid:374)e (cid:271)(cid:455) (cid:862)rerouti(cid:374)g(cid:863) poi(cid:374)ter li(cid:374)ks. Recursive function contains a call to itself. When breaking a task into subtasks, it may be that the subtask is a smaller example of the same task.

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