SLIDE 1
Data Examples Announcements Examples: Objects Land Owners - - PowerPoint PPT Presentation
Data Examples Announcements Examples: Objects Land Owners - - PowerPoint PPT Presentation
Data Examples Announcements Examples: Objects Land Owners Instance attributes are found before class attributes; class attributes are inherited 4 Land Owners Instance attributes are found before class attributes; class attributes are
SLIDE 2
SLIDE 3
Examples: Objects
SLIDE 4
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
SLIDE 5
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker:
SLIDE 6
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir'
SLIDE 7
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker
SLIDE 8
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work'
SLIDE 9
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting
SLIDE 10
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker):
SLIDE 11
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon'
SLIDE 12
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth'
SLIDE 13
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam'
SLIDE 14
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john)
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam'
SLIDE 15
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john)
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' <class Worker> greeting: 'Sir'
SLIDE 16
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john)
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon'
SLIDE 17
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon'
SLIDE 18
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' elf: john <Bourgeoisie>
SLIDE 19
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 20
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 21
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 22
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 23
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 24
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon >>> jack.work() <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 25
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon >>> jack.work() 'Maam, I work' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 26
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon >>> jack.work() 'Maam, I work' >>> john.work() <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 27
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon >>> jack.work() 'Maam, I work' >>> john.work() Peon, I work 'I gather wealth' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 28
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon >>> jack.work() 'Maam, I work' >>> john.work() Peon, I work 'I gather wealth' >>> john.elf.work(john) <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 29
>>> Worker().work() >>> jack >>> jack.work() >>> john.work() >>> john.elf.work(john) jack <Worker> elf:
Land Owners
Instance attributes are found before class attributes; class attributes are inherited
4
class Worker: greeting = 'Sir' def __init__(self): self.elf = Worker def work(self): return self.greeting + ', I work' def __repr__(self): return Bourgeoisie.greeting class Bourgeoisie(Worker): greeting = 'Peon' def work(self): print(Worker.work(self)) return 'I gather wealth' jack = Worker() john = Bourgeoisie() jack.greeting = 'Maam' >>> Worker().work() 'Sir, I work' >>> jack Peon >>> jack.work() 'Maam, I work' >>> john.work() Peon, I work 'I gather wealth' >>> john.elf.work(john) 'Peon, I work' <class Worker> greeting: 'Sir' <class Bourgeoisie> greeting: 'Peon' greeting: 'Maam' elf: john <Bourgeoisie>
SLIDE 30
Examples: Iterables & Iterators
SLIDE 31
Using Built-In Functions & Comprehensions
6
SLIDE 32
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
SLIDE 33
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
[-4, -3, -2, 3, 2, 4]
SLIDE 34
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
[-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5
SLIDE 35
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
[-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4]
SLIDE 36
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
[-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5]
SLIDE 37
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
[-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0]
SLIDE 38
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0]
SLIDE 39
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4]
SLIDE 40
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6
SLIDE 41
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4]
SLIDE 42
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1
SLIDE 43
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) Create a dictionary mapping each digit d to the lists of elements in s that end with d. [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1
SLIDE 44
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) Create a dictionary mapping each digit d to the lists of elements in s that end with d. [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1 [5, 8, 13, 21, 34, 55, 89]
SLIDE 45
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) Create a dictionary mapping each digit d to the lists of elements in s that end with d. [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1 [5, 8, 13, 21, 34, 55, 89] {1: [21], 3: [13], 4: [34], 5: [5, 55], 8: [8], 9: [89]}
SLIDE 46
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) Create a dictionary mapping each digit d to the lists of elements in s that end with d. [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1 Does every element equal some other element in s? [5, 8, 13, 21, 34, 55, 89] {1: [21], 3: [13], 4: [34], 5: [5, 55], 8: [8], 9: [89]}
SLIDE 47
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) Create a dictionary mapping each digit d to the lists of elements in s that end with d. [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1 Does every element equal some other element in s? [5, 8, 13, 21, 34, 55, 89] {1: [21], 3: [13], 4: [34], 5: [5, 55], 8: [8], 9: [89]} [-4, -3, -2, 3, 2, 4] False
SLIDE 48
Using Built-In Functions & Comprehensions
What are the indices of all elements in a list s that have the smallest absolute value?
6
What's the largest sum of two adjacent elements in a list s? (Assume len(s) > 1) Create a dictionary mapping each digit d to the lists of elements in s that end with d. [-4, -3, -2, 3, 2, 4] 0 1 2 3 4 5 [2, 4] [1, 2, 3, 4, 5] [0] [-4, -3, -2, 3, 2, 4] 6 [-4, 3, -2, -3, 2, -4] 1 Does every element equal some other element in s? [5, 8, 13, 21, 34, 55, 89] {1: [21], 3: [13], 4: [34], 5: [5, 55], 8: [8], 9: [89]} [-4, -3, -2, 3, 2, 4] False [4, 3, 2, 3, 2, 4] True
SLIDE 49
Examples: Linked Lists
SLIDE 50
Linked List Exercises
8
SLIDE 51
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
SLIDE 52
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
1 3 4
SLIDE 53
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
1 3 4 1 4 3
SLIDE 54
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? 1 3 4 1 4 3
SLIDE 55
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? 1 3 4 1
- 3
4 1 4 3
SLIDE 56
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? 1 3 4 1
- 3
4 1 4
- 3
1 4 3
SLIDE 57
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. 1 3 4 1
- 3
4 1 4
- 3
1 4 3
SLIDE 58
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. 1 3 4 1
- 3
4 1 4
- 3
1 5 1 4 1 4 3
SLIDE 59
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. 1 3 4 1
- 3
4 1 4
- 3
1 5 1 4 1 4 5 1 1 4 3
SLIDE 60
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. Do the same thing, but never call Link. 1 3 4 1
- 3
4 1 4
- 3
1 5 1 4 1 4 5 1 1 4 3
SLIDE 61
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. Do the same thing, but never call Link. 1 3 4 1
- 3
4 1 4
- 3
1 5 1 4 1 4 5 1 1 5 1 4 1 4 3
SLIDE 62
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. Do the same thing, but never call Link. 1 3 4 1
- 3
4 1 4
- 3
1 5 1 4 1 4 5 1 1 5 1 4
x
1 4 3
SLIDE 63
Linked List Exercises
Is a linked list s ordered from least to greatest?
8
Is a linked list s ordered from least to greatest by absolute value (or a key function)? Create a sorted Link containing all the elements of both sorted Links s & t. Do the same thing, but never call Link. 1 3 4 1
- 3
4 1 4
- 3