

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
An introduction to media computation, discussing the concepts of compilation and interpretation, the complexity of algorithms, and the role of hardware in computer processing. It compares compiled and interpreted programs, using examples like adobe photoshop and java, and explains the advantages and disadvantages of each. Additionally, it introduces the concept of the traveling salesman problem and its current limitations in finding optimal solutions.
Typology: Study notes
1 / 3
This page cannot be seen from the preview
Don't miss anything!


Speed and Complexity Why is Photoshop so much faster?
Compilation and interpretation Assembly language Interpreters Compilers Complexity of algorithms Hardware
machine language Apple computers typically use CPU ( processor) chips called G4 or G5. Computers running Microsoft Windows may use Pentium processors. There are other processors called Alpha, LSI-11, and on and on. Each processor understands only its own machine language
quickly A mid-range laptop these days has a clock rate of 1.5 Gigahertz. What that means exactly is hard to explain, but let’s interpret it as processing 1.5 billion bytes per second. Those 12 bytes would execute inside the computer, then, in 12/1,500,000,000th^ of a second! Compiled vs. Interpreted Programs Applications like Adobe Photoshop and Microsoft Word are compiled. This means that they execute in the computer as pure machine language. They execute at that level speed. However, Python, Java, Scheme, and many other languages are (in many cases) interpreted. They execute at a slower speed. Why? It’s the difference between translating instructions and directly executing instructions.
Applications like Photoshop and Word are written in languages like C or C++ These languages are then compiled down to machine language. That stuff that executes at a rate of 1.5 billion bytes per second. Jython programs are interpreted. Actually, they’re interpreted twice!
For us, to have a command area. Compiled languages don where you can print things and try out functions.’t typically have a command area Interpreted languages help the learner figure out what going on. ’s For others, to maintain portability. Java can be compiled to machine language. In fact, some VMs will actually compile the virtual machine language for you while running—no special compilation needed. But once you do that, the result can only run on one kind of computer. Programs for Java (.jar files typically) can be moved from any kind of computer to any other kind of computer and just work.
Java code is compiled into a machine language (called byte code) for a fictitious machine, the Java Virtual Machine. Each computer that can execute Java has an interpreter for the Java machine language. Interpreting Java machine is pretty easy Takes only a small program Devices as small as wristwatches can run Java VM interpreters. More than one way to solve a problem There’s always more than one way to solve a problem. To go from Architecture to the Student Center you can cut across the parking lot and the field, OR you can walk just on sidewalks Some solutions are better (faster, shorter, less muddy) than others. How do you compare them? Finding something in the dictionary Simple algorithm Start from the beginning. Check each page, until you find what you want. Not very efficient Best case (you find the word on the first page you check): One step Worse case (it’s on the last page in the dictionary): n steps where n = number of pages Average case: n/2 steps
Better algorithm Split the dictionary in the middle. Is the word you’re at before or after the page you’re looking at? If after, look from the middle to the end. If before, look from the start to the middle. Keep repeating until done or until it couldn’t be there. More efficient: Best case: It’s there in the first place you look. Average and worst case: log n steps The Traveling Salesman Problem Imagine that you’re a sales person, and you’re responsible for a bunch of different clients. Let’s say 30—half the size of our optimization problem. To be efficient, you want to find the shortest path that will let you visit each client exactly once, and not more than once. Being a smart graduate of CS1315, you decide to write a program to do it.