CSCA48H3 Lecture Notes - Lecture 3: Linked List, Newline, Repeating Decimal

116 views8 pages
16 Jan 2016
School
Course

Document Summary

We have seen examples of attributes that refer to other objects, which we called embedded references. A common data structure, the linked list, takes advantage of this feature. Linked lists are made up of nodes, where each node contains a reference to the next node in the list. In addition, each node contains a unit of data called the cargo. A linked list is considered a recursive data structure because it has a recursive definition. A linked list is either: the empty list, represented by none, or, a node that contains a cargo object and a reference to a linked list. Recursive data structures lend themselves to recursive methods: the node class. As usual when writing a new class, we"ll start with the initialization and __str__ methods so that we can test the basic mechanism of creating and displaying the new type: As usual, the parameters for the initialization method are optional.

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