Interactive Applets for Introductory Computer Science Lectures
|
Casey W. Manion, Robert Ottaway, and
Michael J. Quinn
School of Electrical Engineering and Computer Science
|
Introduction
This page contains links to Java applets designed to enhance
the lectures given students taking an introductory computer science class.
The applets are organized according to how they relate to the
table of contents of J. Glenn Brookshear's
Computer Science: An Overview,
Eighth Edition, which is the book used at Oregon State University.
However, for the most part the applets are independent of this particular
textbook.
The principal exception is the applet implementing the Brookshear's
simple machine language.
Try to run one of the applets below. If the applet fails to run, you
may need to download and install the Java runtime environment.
Here is a
link to the Sun Microsystems Web site that contains the J2SE Runtime
Environment (JRE) that allows you to run Java applications.
When you go to this page, click on "Download J2SE JRE" and follow the
directions to download just the runtime environment.
Alternatively, you may click on "Download J2SE SDK" and follow the
directions to download the entire J2SE Software Development Kit.
(You don't need both.)
If you would like to store a copy of this Web page and all of the
applets on your local computer, download this
zip file
and extract its contents into a new folder.
Open file applets.html with your Web browser.
Acknowledgement
This work was supported by a grant from the
William and Flora Hewlett Foundation through its
Engineering Schools of the West initiative.
Chapter 1: Data Storage
- Boolean Operations.
Demonstrates the AND, OR, XOR, NAND, NOR, and XNOR operators for
binary values of varying length. In demo mode you flip operand bits
and watch the result change. In test mode the result is fixed, and you
attempt to set the operand bits to produce the correct result.
- Gates and Flip-Flops.
Demonstrates combinatorial circuits and flip-flops.
Right click on the gate position to choose or change the gate type.
Click on an input bit to flip its value.
When input values change, the output of the circuit is recomputed.
- Binary, Octal, Decimal,
and Hexadecimal Notation.
Given a number in binary, decimal, hexadecimal, or octal format,
the user converts the number into another format.
- Two's Complement Addition.
Demonstrates addition of integers stored in two's complement format.
In demo mode you click on operand bits to flip their values.
The result is automatically updated.
In test mode the result and the second operand are fixed.
Flip bits of the first operand to make the sum correct.
- Storing Fractions.
Converts 8-bit floating-point numbers into decimal form.
Click on top-row bits to flip their value.
The applet produces the base-10 equivalent.
The text box provides a step-by-step explanation of the conversion.
Chapter 2: Data Manipulation
-
Compiler for Brookshear's Machine Language.
This applet was written by Rogan Creswick, a former undergraduate
at Oregon State University.
Type in Brookshear machine language programs and watch them execute.
The applet lets you examine the values of all registers memory locations
as the program executes.
It highlights locations that are accessed or modified.
Chapter 3: Operating Systems
- CPU Scheduling.
Lets you compare the performance of four different CPU scheduling algorithms:
first-come, first-served; shortest job first; shortest job first with
preemption; and round-robin.
- Dining Philosophers: Deadlock
and Starvation.
Demonstrates starvation and deadlock in the context of the Dining
Philosophers problem. In quiz mode you are asked to create a deadlock.
Chapter 4: Networking and the Internet
- Packet Routing.
Demonstrates a layered approach to transferring data across large networks.
Click demo mode to start the data transfer.
A three-packet message is transported from the source computer
on the upper left to a randomly chosen destination computer.
A red X over a link means it is currently not available.
Click on Test Mode to route a message yourself.
The Network Layer box contains the IP address of the destination computer.
Click on each intermediate computer in turn to route the message.
- Network Routing.
Demonstrates Next Hop packet routing on a simulated network. Each
time applet is loaded the network diagram changes. The
user must set up each network's routing table by clicking on the network
tab and filling out the routing table. After all the routing tables are
set up, test the network by using the send packet button on the network
tab.
Chapter 5: Algorithms
- Magnetic Disks.
Compares two different algorithms for deciding the file access order.
The FCFS (first-come first-served) algorithm puts access requests in a queue.
The Elevator algorithm puts access reqeusts in a priority queue based on the
direction of motion of the disk head.
Click on file icons to add requests to both queues and observe the
performance difference of the two algorithms.
- While/Repeat Loop Conversions.
Convert a repeat loop into a while loop or vice versa.
The left window contains the original loop.
Type the converted loop into the right window.
Click on the Check button to see if your conversion is correct.
The conversion must be exactly correct, including semicolons.
Click on the > button to go to the next problem.
Click on the < button to go to the previous problem.
- Searching Algorithms.
Compares sequential search with binary search.
Click on Start to watch a single search.
Click on Demo to begin a series of searches.
The graph at the bottom of the applet displays the average number of
comparisons required by each algorithm.
Move the slider button to modify the number of items.
Click on the spinner box to choose the animation speed (Slow, Medium,
and Fast).
Click on the Sort Sequential Items box to change the left list from
unsorted to sorted.
- Sorting Algorithms.
Compares the relative speeds of two selected sorts from
Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, and Quick Sort.
Move the slider to change the number of items being sorted.
Chapter 6: Programming Languages
- Parse Trees.
Displays the parse tree for an expression input by the user.
The expression may contain integer and floating-point values, parentheses,
and the operators +, -, *, and /.
Enter an expression into the text box at the top of the applet and
click the Parse button.
The applet will display the parse tree for the expression.
The operators * and / have higher precedence than the operators + and -.
Chapter 7: Software Engineering
- Software Testing.
Contains three different projects. The user can
check out a project, test it for bugs, and either check it back in
(so bugs can be fixed) or release it to the public.
Chapter 10: Artificial Intelligence
- Search Trees.
Compares two exhaustive search methods (breadth-first search and
depth-first search) on 2-by-3 sliding tile puzzle.
Click on Scramble Puzzle to scramble the puzzle, or click on a tile
next to the blank square to change the puzzle.
Use the radio buttons to switch between breadth-first and depth-first search.
Click on Step to examine a single node of the state space tree.
Click on Run to animate the search.
The status window reveals the depth of the search (Level),
the number of nodes examined so far (Checked), and the number of
unexamined nodes currently in the stack (in the case of
depth-first search) or queue (in the case of breadth-first search).
Chapter 11: Theory of Computation
- Turing Machine.
Animates the actions of a Turing Machine.
Click Start to run the animation.
Click Step to advance the simulation a single step.
Click the spinner to change the speed of the animation.
Right-click on the table to change between the two programs:
binary adder and palindrome checker.
Click the arrow buttons to move the tape underneath the read/write head.
This applet is adapted from an
applet
written by Suzanne Skinner. Thank you, Suzanne!
Page created by
Michael J. Quinn.
Last modification: 12 September 2005