Average Case Flashcards
What is the intuition behind average case algorithms?

What is the definition of Expectation of variable T?

Find the expectation of T for the following:


Find the expactation of the following:


What is a Randomized Algorithm?

What is the randomized algorithm type: Las Vegas?
What is an example of this algorithm?

What is the randomised algorithm type; Monte Carlo?

What are the advantages/disadvantages of randomized algorithms in general?

What are the advantages/disadvantages of Las Vegas algorithms?

What are the advantages/disadvantages of Monte Carlo algorithms?

Why does it make more sense to think about expected time instead of worst-case time for Las Vegas algorithms?

In general, how is MySQL used in PHP?

What are JSPs?
For scripting languages in general, what benefits that does provide?
Java Server Pages (JSP):
Like PHP, JSPs consist of static elements (normally text and HTML) and JSP “Elements” that generate dynamic content.
JSPs provide:
- Language for developing text-based pages that describe how to process a request to create an HTML response
- A means of accessing server-side objects
- to provide a means of generating the dynamic content using information nt directly avail to the JPS
- A mechanism for extending the JSP language
- Which helps simplify repeated taskss and for future evolution of JSP technology
Which means:
- Separates the “user interface” (html) from content generation (script code)
- so we can change the page layout without changing code generating the dynamic content
- easier and faster development of web applications
- Decreased maintenance effort for web applications
- hence lower cost, more reliable
What tags enclose a Java expression that is to be evaluated for JPS?
The time is
JSP support the embedding of short sequences of Java code, what do we call them?
What tags are used ot do this?
Called “Scriptlets”, these are embedded in HTML pages
Done with the tags (not that the ‘=’ sign is missing)
The time is:
NOTE: The declaration persists across tags
In general how would JSP be used to access submitted form data?
request.getParameter(“fname”) %>
The object request is built into JSPs and refs to the HTTP request recived by the webserver from the web browser (which contains the form data).
With JSPs and declarations, what does one need to remain mindful of?
Declarations are only processed once
Any declared data must be guarded to prevent invalid concurrent access
- because there are multi-threaded
- access must be synchronized
How would you use JSPs to include another page?
could have body here
This is an example of using predefined tags
What are ASPs?
Active Server Pages
- This is mircrosoft’s JSP “equivalent”
- Capabilities of JSPs and ASPs are very similar
- JSPs are tied to java, ASPs are more flexible
- ASP.net allows any .net language
What is required of the web server to run ASP scripts
An ASP-enabled web server supports the execution of server-sive ASP scripts
Such a server will invoke the ASP processory whenever a file with a .asp sufffix is encountered
- These need to be in an ASP enabled folder
In the ASP “Programming” model, what objects are available for use in ASP scripts?

At it’s most basic level what is the ASP Application object?
It represents the entire web application, conisisting of the various pages and associated scripts
It is initialized by the web server when the first client requests a related file
There is only a single Application object for a given application running on a server (even if there are many users)
- which of course would allow for sharing of information between clients
What is an Application object’s physical manifestation?
All the .asp files in it’s corresponding [virtual] directory
- virtual directory = the directory name as viewed by the suers of the system via the web
- A web server often maps from a virtual directory to a different physical directory
- /images to /etc/httpd/images
- A web server often maps from a virtual directory to a different physical directory
Each Application object maintains colelctions of application-level variables and objects that have been added to it.
How are they accessed?
Collections are essentiall object-based associative arrays
Application.Contents - contains the share variables
Application.StaticObjects - maintains the object references
Elements in collections can be manipulated by it’s position index or the associated key
- Assignment
- Application.Contents.Item(“pi”) = 3.14
- Reference
- pi=Application.Contents.Item(“pi”)
- pi=Application.Contents.Item(7)
- Or using the shortcut
- Application.contents(“pi”)
- Application(“pi”)




