Mathematical Techniques for Computer Science (COMP11120)
Class notes
Lecture Notes on Lists (COMP11120)
8 views 0 purchase
Course
Mathematical Techniques for Computer Science (COMP11120)
Institution
The University Of Manchester (UOM)
Master the fundamentals of lists with these comprehensive lecture notes for COMP11120. Covering essential topics such as list operations, properties, and various traversal techniques, these notes provide clear explanations and practical examples to help you understand and utilize lists effectively....
= 1 + 2 + 1 + 0 be sum
Example : ForI t given by base case [l + 11 = 1
=
4 Step case (5 : 1) H = 5 : ((11 ()
Show that for all Le Lists (+ [T =
,
[J
So is unit for it
Example Define : a operation rev : Lists >
Lists that reverses a list.
Proof by induction :
L
L
base rev[] = [] base case [J + []
=
[]
case
Step case rev(s : 1) = revL #ISI Step case (5 : (15) =
5 :
((it)) #
base Case !
=
S
: step case
Example : Show summer) = sum for all Le Lists
You may use sum (1H1') =
Suml + suml Example : Show forthat all 1, 11E Lists IN
,
sum((H(1) = sum) + Sum(
Proof by induction :
base case Sumrev[] =
SumI] be nev Proof by induction :
Step case sum rev (5 : 1) =
Sum(rov1H [s]) Sc rev base case Sum([]111) = Sum I' be concat
("
=
Sum(rev() + sum(s : []) ind . hyp
.
= O + Sum
= sumY + 5 + sumI]
Sc Sum = sum[I + sumI' be sum
Suml
=
+ 5 + 0 be Sum
=
S + sum Step case Sum(15 : 1) H() =
sum(s : (1 + 1)) Sc concert
= Sum(5 : () = S + Sum(( + 1) sc sum
= S + sum) + suml' ind .
hyp .
= Sum (s : 1) + suml" sc Sum
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller jpxoi. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.13. You're not tied to anything after your purchase.