Java Reference
In-Depth Information
chapter
13
simulation
A n important use of computers is for simulation, in which the computer
is used to emulate the operation of a real system and gather statistics. For
example, we might want to simulate the operation of a bank with k tellers to
determine the minimum value of k that gives reasonable service time. Using
a computer for this task has many advantages. First, the information would
be gathered without involving real customers. Second, a simulation by com-
puter can be faster than the actual implementation because of the speed of
the computer. Third, the simulation could be easily replicated. In many cases,
the proper choice of data structures can help us improve the efficiency of the
simulation.
In this chapter, we show
An important use of
computers is simu-
lation, in which the
computer is used to
emulate the opera-
tion of a real sys-
tem and gather
statistics.
How to simulate a game modeled on the Josephus problem
n
How to simulate the operation of a computer modem bank
n
the josephus problem
13.1
The Josephus problem is the following game: N people, numbered 1 to N , are
sitting in a circle; starting at person 1, a hot potato is passed; after M passes,
 
 
Search WWH ::




Custom Search