You are on page 1of 5

Computer Networks (ICS-582) Home Work # 1

Submitted by Ghazanfar Latif
(201103070)

Submitted to Dr. SABRI MAHMOUD

King Fahd University of Petroleum and Minerals, Dhahran (Saudi Arabia)

htm” and “. and handle an arbitrary amount of directory nesting.org” domains. email. news. q0 … Domain Label … microsoft google amidest …… …… q1 . Be sure to accept addresses from the “.htm .shtml q3 . Solution: Sub Domain Label/ Prefix with dot “.shtml” page types.html . “.html”. www.” docs.com .Question (1) Design an FSA that accepts only valid web addresses. Accept at least “.org q2 Directory Name / q3 Web Page Name without extension q3 .com” and “.

the language accepts a from q0 to q1. then it will accept a (a b a ? ) + once and goes for the and the loop continues. b from q1 to q2. So the final expression will look like: . then it accepts or q1 to q3. then it need to accept aa from q3 to q2 and then q1.Question (2) Write a regular expression for the language accepted by the NFSA in the figure below? Solution: According to the regular expression. While if it accepts loop. After that it if it accepts b from q1 to q2 b from q1 to q3.

in marathon.Question (3) Design an FSA that recognizes finish times for top runners in a marathon. Solution: q0 Top Runner 1 took Top Runner 2 took . Times are reported to nearest second. . “minute” and “hour” have the proper singular or plural endings when appropriate. q4 . 59 minutes in marathon. . . . Make sure that “second”. . 59 seconds in marathon. Top Runner N took 1 minute 2 minutes 3 minutes 4 minutes . . It should handle all times up to 5 five hours. . 59 seconds 1 second 2 seconds 3 seconds 4 seconds . 59 minutes q1 1 hour 2 hours 3 hours 4 hours 5 hours q3 1 second 2 seconds 3 seconds 4 seconds . 59 seconds q2 1 minute 2 minutes 3 minutes 4 minutes . . q5 in marathon. . . q4 1 second 2 seconds 3 seconds 4 seconds . .

z. For example we have list of arcs ^. s. x are coming to state q1 from state q0.Question (4) In Fig. q5. x from q5 to q1 are not present. s. If the arc z. 3. s. ε. We can found the counter example of invalid path by following the sequence where the arc z. s. x does not come from q5 to q1 and these arcs z. q0  q1  q2  q5  q0  q1  q0 The output of this string can be s^ss^s# which needs to follow the following path: q0  q1  q2  q5  q1  q5  q0 . q1 self-loop while arc z. The below given sequence of path brings us to invalid string. x will belongs to others category. x. #. s. s. x arc from q5 to q1? Solution: The state q0 is start state and all the arc z.17. it would produce invalid string of arcs. why is there a z. x are pointing to q1 from q2.