CS234 Midterm: CS234 Midterm Review - S16

292 views4 pages

Document Summary

We can not compare algorithms based on o-notation. Postcondition: guaranteed result if the preconditions are met. Precondition: assumed to be true, error if not satisfied (ex. index out of range) Recursion: an implementation of an algorithm using a computer language calls itself and results in a virtual repetition loop. Pseudo-code: independent of hardware/software environment, instead of time, counts the number of primitive operations, user order notation to ignore constants and low-order terms. Data is stored in a computer as a sequence of digits, whereas a data type comes along with a collection of operations. Data types can be characterized by: simple: consists of single value (ex. Integer, dates: complex: consists of multiple values (ex. lists, tuples, dictionary) Or: primitive: provided by the language itself (ex. int, float, string, user-defined: defined by the programmer (ex. class definitions student record) An array is a very efficient primitive data type because it uses constant time.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers