Vous êtes sur la page 1sur 2

SCHOOL OF COMPUTER SCIENCES

SEMESTER II ACADEMIC SESSION 2017/2018


CPT113/CPM213
Programming Methodology & Data Structures

ASSIGNMENT 3 - Flying Traveller: A Search Problem

Problem Description:

The Flying Traveller Airline Company (FTAir) wants a program to process customer
requests to fly from some origin city to some destination city. For each customer,
indicate whether a sequence of FTAir flights from the origin city to the destination city
exists and produce the itinerary sequence of flights.

Input:

Three input text files that specify all the flights information as follow:

The names of cities that FTAir serves (at least 15 cities).


Pairs of city names; each pair represents the origin and destination of one of
FTAirs flights.
Pair of city names; each pair represents a request to fly from some origin city
to some destination (at least 5 requests with different scenarios). Each
request considered a one-way flight.

Rules:

Find a path from origin city to destination city, if exists.


Maintain information about the order in which it visits the cities.
Do not visit a city more than once.
If there are multiple paths, you may list them all and find least visited cities.
(optional).

Example:

Consider the following example in the graph to help understand the problem.

KBR You have 5 cities and


16 possible flights:
PEN KL
PEN IPH
PEN KBR
PEN KL IPH JHB KL
JHB PEN
JHB IPH
JHB KBR
JHB KL PEN
Scenario 1: Travel request from PEN to KBR goes PEN KL KL IPH
KL IPH
through 3 flight sequences. IPH KBR KL KBR
IPH KBR
Scenario 2: Travel request from JHB to KL is a IPH KL
JHB KL
non-stop flight (one sequence) IPH PEN
KBR KL
Scenario 3: Travel request from KL to JHB is not KBR PEN
No flight
possible (no path) KBR IPH

1
Solutions methods:

1. Use Stacks
2. Use Recursions

Reports:

Explain the problems and describe your solutions using stacks and
recursions. It should be correct, efficient, informative, user friendly, flexible,
creative and robust by adding other necessary operations.
Discuss the relationship between Stacks and Recursions methods in solving
this problem. Relate the way stack organizes the search for a sequence of
flights to the way a recursive algorithms organize the search. Highlight the
key aspects of their common strategy.
Print both programs, input files and their outputs. Analyze the results.

Instructions:

Please submit your assignment (individually) by Monday 15 May 2017 in 2 versions:

Softcopy: Upload into e-learning. Save all the necessary documents in one
folder and zip the folder before you upload.

The name of the folder that you upload must follow this standard:
ASSN3_YOURFULLNAME_MATRICNUMBER. Your file name is
YOURMATRICNUMBER. Your folder consists of the report, source code and
the test data.

Hardcopy: Submit the printed document with attached CD into postbox with
label CPT113 at level 6. Please bind with colored cover page (Group AB:
Blue) (Group CD: Green) (Group EF: Yellow) (Group G: Red) with the
following information:

Course: CPT113/CPM213
Assignment: 3
Date Due: 15 May 2017
Name:
Matric No:
Group:

Course Policy:

All assignments MUST be submitted before/on the given date. Late submissions
without prior approval from the lecturer will not be accepted. One grade will be
deducted for each day, for students with approval.
If a student is found to misuse the amenities given, the permission will be taken
away from the student.
Plagiarism/pirating and copying are serious academic offence. Students that are
found to plagiarize/or copying will get an F for the assignment.

Vous aimerez peut-être aussi