Zusammenfassung der Ressource
Frage 1
Frage
Tick the answer(s). There can be more than one answers
In order to recursively define an entity, we need
Antworten
-
A number of base cases - describes simple instances of the entity
-
A number of step cases - describes complicated instances of the entity
-
Define the operations should do for each base cases
-
Define the operations should do for each step cases
-
Come out with the algorithm first
Frage 2
Frage
[40, 20, 3] = [blank_start]40 : [20, 3][blank_end]
= [blank_start]40 : 20 : [3][blank_end]
= [blank_start]40 : 20 : 3 : [ ][blank_end]
Antworten
-
40 : [20, 3]
-
40 : 20 : [3]
-
40 : 20 : 3 : [ ]
Frage 3
Frage
Is the mathematical recursive definition related to programming?
Frage 4
Frage
add[2, 4, 10] = [blank_start]add( 2 : [4, 10] )[blank_end]
= 2 + [blank_start]add[4, 10][blank_end]
= 2 + [blank_start]add( 4 : [10] )[blank_end]
= 2 + 4 + [blank_start]add[10][blank_end]
= 2 + 4 + [blank_start]add( 10 : [ ] )[blank_end]
= [blank_start]2 + 4 + 10 + add[ ][blank_end]
= 2 + 4 + 10
= 16
Antworten
-
add( 2 : [4, 10] )
-
2 + 4 + 10 + add[ ]
-
add( 10 : [ ] )
-
add[4, 10]
-
add( 4 : [10] )
-
add[10]
Frage 5
Frage
[99, 9] ++ [23, 1] = [blank_start](99 : [9]) ++ [23, 1][blank_end]
= 99 : [blank_start]([9] ++ [23, 1])[blank_end]
= 99 : [blank_start]((9 : [ ]) ++ [23, 1])[blank_end]
= 99 : [blank_start](9 : ([ ] ++ [23, 1]))[blank_end]
= 99 : [blank_start](9 : ([23, 1]))[blank_end]
= 99 : 9 : [23, 1]
= [99, 9, 23, 1]
Antworten
-
(99 : [9]) ++ [23, 1]
-
([9] ++ [23, 1])
-
((9 : [ ]) ++ [23, 1])
-
(9 : ([ ] ++ [23, 1]))
-
(9 : ([23, 1]))
Frage 6
Frage
Can we prove the property by induction?
Frage 7
Frage
What are the orders to prove them?
1) Replace the statement with [blank_start]the base case of Lists[blank_end]
2) Prove the replaced statement using [blank_start]the properties given[blank_end]
3) Replace the statement with [blank_start]the step case of Lists[blank_end]
4) Prove the replaced statement using [blank_start]the properties given[blank_end]
5) Make us of [blank_start]the induction hypothesis[blank_end]
Antworten
-
the base case of Lists
-
the properties given
-
the step case of Lists
-
the property given
-
the induction hypothesis