Data Examples Announcements Examples: Objects Land Owners - - PowerPoint PPT Presentation

data examples announcements examples objects land owners
SMART_READER_LITE
LIVE PREVIEW

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-1
SLIDE 1

Data Examples

slide-2
SLIDE 2

Announcements

slide-3
SLIDE 3

Examples: Objects

slide-4
SLIDE 4

Land Owners

Instance attributes are found before class attributes; class attributes are inherited

4

slide-5
SLIDE 5

Land Owners

Instance attributes are found before class attributes; class attributes are inherited

4

class Worker:

slide-6
SLIDE 6

Land Owners

Instance attributes are found before class attributes; class attributes are inherited

4

class Worker: greeting = 'Sir'

slide-7
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
SLIDE 30

Examples: Iterables & Iterators

slide-31
SLIDE 31

Using Built-In Functions & Comprehensions

6

slide-32
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
SLIDE 49

Examples: Linked Lists

slide-50
SLIDE 50

Linked List Exercises

8

slide-51
SLIDE 51

Linked List Exercises

Is a linked list s ordered from least to greatest?

8

slide-52
SLIDE 52

Linked List Exercises

Is a linked list s ordered from least to greatest?

8

1 3 4

slide-53
SLIDE 53

Linked List Exercises

Is a linked list s ordered from least to greatest?

8

1 3 4 1 4 3

slide-54
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
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
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
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
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
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
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
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
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
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

1 5 1 4 1 4 5 1 1 5 1 4

x x

1 4 3