Midterm 2 review

Download Report

Transcript Midterm 2 review

Midterm 2
review
Pseudocode: Flowchart
Fixing non functioning
lamp algorithm
7/21/2015
2
Data types
• Three categories of primitive data types:
numerical, string, and boolean.
• A numerical variable represents a number.
• A string variable represents text, for example "2" and "asdf".
• A boolean represents either true or false.
Big O notation ranking
Big-O
Name
Speed
Computations
O(1)
Constant runtime
Very fast, does not depend
on size of input.
Very few, does not depend on
size of input
O(log(n))
Logarithmic runtime
Very fast.
Few, depends only a little bit
on size of input
O(n)
Linear runtime
Fast.
Some, depending linearly on
size of input
O(n*log(n))
n*log(n) runtime
Acceptable.
Depends more on size of
input
O(n2)
Quadratic runtime
Slow.
A lot, depending on size of
input. If n doubles, runtime
quadruples.
O(n3), O(n4), ...
Polynomial runtime
Very slow.
Way too many computations,
not very scalable.
O(2n)
Exponential runtime
Intractable (worst).
Ridiculous amount of
computations, cannot scale.
Static vs. Dynamic web page
• A static web page is a web page that is delivered to the user exactly as
stored.
• Dynamic web pages are generated by a web application.
Page Structure
• HTML elements control the details of how a page gets displayed.
• Every HTML document has the following basic structure:
<HTML>
<HEAD>
…
</HEAD>
<BODY>
…
</BODY>
</HTML>
Table
Why CSS?
• CSS removes the presentation attributes from the structure allowing
reusability, ease of maintainability, and an interchangeable
presentation layer.
• HTML was never meant to be a presentation language. Proprietary
vendors have created tags to add presentation to structure.
• <font>
• <b>
• <i>
• CSS allows us to make global and instantaneous changes easily.
WHAT IS JAVASCRIPT?
• JavaScript was designed to add interactivity to HTML pages
• JavaScript is a scripting language (a scripting language is a lightweight
programming language)
• A JavaScript consists of lines of executable computer code
• A JavaScript is usually embedded directly into HTML pages
• JavaScript is an interpreted language (means that scripts execute without
preliminary compilation)
• Everyone can use JavaScript without purchasing a license
7/21/2015
9