S → ε S → aSbShow how S can derive the string "aaabbb" (also known as
εrepresents the empty string; Rosen uses
λfor this same purpose.)
S ⇒*.a Sb
1 /--\ | | V | +------+ 0 +------+ 1 +------+ | |<------| |<------| | | s0 | | s1 |<---0--| s2 | | |------>| |------>| | +------+ 0 +------+ 1 +------+This FSM doesn't seem to have any obvious purpose.
We'll model the progression of a volleyball game with a finite state machine. Our first attempt will be overly simplistic, but we'll add some features to arrive at a slightly less simplistic version.
state: team2-to-serve input: Succeed [indicates team 2 served successfully.] state: team1-to-returnSpecify the 4-state FSM best modeling a volleyball game,We'll consider a return as a single event, and not model how it might be made up of up to three individual hits by one team. Clearly, you could certainly model the up-to-three hits by refining your FSM, though it might need inputs (the ref) distinguishing between a hit which wasn't a return but wasn't drop-the-ball either. input: Fail [oops, team 1 failed to return the ball.] state: team-2-to-serve ...
This was how we played in my (dreaded) junior high PE. However, more competitive volleyball might only allow re-serves when the serve hit the net; I'm not sure.
Regardless, for our purposes, once a re-serve resolves, the botched serve is forgotten; thus there can be a re-serve every single volley.
We'll need to replace Srv1 with two states — whether its the first serve attempt, or the second. Call these Srv1a and Srv1b. (Similarly for Srv2, of course.)
(Here's the table form of the answer, although the graph is what you were asked for)
We'll add states IncScore1 and IncScore2. In addition, during a volley (Ret1 and Ret2), we need to keep track of which team served . We'll call these Ret1a (meaning team1 served) and Ret1b (meaning team 2 served).
(Here's the table form of the answer, although the graph is what you were asked for)
Alistair: W,X,Y,Z Bernie: W,X,Z,Y Corky: W,Y,Z,X Dweezil: X,W,Y,Z Winnie: A,B,C,D Xena: C,B,D,A Yolanda: D,B,A,C Zelda: C,B,A,DThe task is to come up with a pairing of each person with someone of the opposite gender.
For example,
one dating company, HappyGuys
might come up with:
A+W,
B+X,
C+Y,
D+Z.
Another company, HappyGals
tried:
A+W,
C+X,
D+Y,
B+Z.
A: Y,Z B: Z,Y Y: A,B Z: B,AThere are only two possible solutions: {A+Y,B+Z} and {A+Z,B+Y}.
A: Z,Y B: Y,Z Y: A,B Z: B,AThere are still only two possible solutions: {A+Y,B+Z} and {A+Z,B+Y}.
In fact, with two men and two women, there are is only one other fundamentally different input:
A: Y,Z B: Y,Z Y: A,B Z: A,BAll other inputs merely involve swapping the names A,B and X,Y (or both).
In the HappyGals solution to the example given above, what happens, when Bernie+Zelda happen to go out to the same restaurant as Corky+Xena?
Finally, consider
The Suitor's Algorithm (phrased in medieval terms):
We will talk about this algorithm in lecture,
starting with the question of whether or not it is guaranteed to terminate.
Sets M and F (males and females), where they are the same size and disjoint (|M|=|F| and M∩F = φ).
Each person's preference is
a functions
p: M→
Actually, we can be more precise, since people can't be repeated in a preference list; each person has in mind a permutation of the other gender: p : M→π(F) and p : F→π(M)
A solution is a matching function: s : M→F, s : F→M.