CSC 216 Lecture Notes - Lecture 19: Formal Verification, Short Code, Precondition

102 views3 pages
1 Nov 2016
School
Course
Professor

Document Summary

Recursion: the definition of an operation in terms of itself; solving a problem using recursion depends on solving smaller occurrences of the same problem. Recursive programming: writing methods that call themselves to solve problems recursively: an equally powerful substitute for iteration (loops, particularly well-suited for solving certain types of problems. Why is recursion useful: ma(cid:374)(cid:455) progra(cid:373)(cid:373)i(cid:374)g la(cid:374)guages ((cid:862)fu(cid:374)ctio(cid:374)al(cid:863) la(cid:374)guages such as che(cid:373)e, ml, a(cid:374)d. Haskell) use recursion exclusively (no loops: (cid:862)cultural e(cid:454)perie(cid:374)ce(cid:863) - a different way of thinking of problems, can solve some kinds of problems better than iteration, leads to elega(cid:374)t, si(cid:373)plistic, short code (cid:449)he(cid:374) used (cid:449)ell . Recursion is all about breaking a big problem into smaller occurrences of the same problem: each person can solve a small part of the problem. Recursive algorithm: e(cid:454)a(cid:373)ple: people i(cid:374) a li(cid:374)e . The person at the front of the line asks how many people are behind them.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers