First Resit problem solving a ssignment

advertisement
Assignment : Submission date 2nd of May 2014
Problem solving coursework
IS50001B (FY05) Foundations of Problem Solving and Programming
Question1
At Silversmiths College, the MSc in Computational Creativity is graded as follows:


Each student takes 5 taught courses and writes a dissertation.
Each course is worth 10% of the final mark and the dissertation is worth
50%.
 Students must get at least half marks on each element in order to pass the
degree.
 The final grade is calculated as: Fail 0 – 49%, Pass 50-59%, Merit 6069%, Distinction 70% or above.
a) Design an algorithm to calculate the final grade, given a student’s coursework
and dissertation marks, and give worked examples of students who would get
Fail, Pass, Merit and Distinction grades.
b) Explain how you can modify your algorithm to calculate the results for a class
of 12 students.
Question2
Describe an example of a problem we have looked at in this course where a
change in the way the problem is represented can make it easier to see an
efficient solution. Your answer should be understandable by someone who
has not attended this course and has not read How to think like a programmer.
Question 3
a) What is binary search? Give an example
b) Consider a list of 12 integer items.
1. Give a best-case scenario of binary search!
2. Give a worst-case scenario of binary search! How many comparisons
are performed?
c) You are given a pile of tests with students’ names on them. You need to find
a particular paper. Should you use linear or binary search? Why?
d) You were given the following list of students’ names and their corresponding
6-digits ID numbers:
Jasper B
Jiongyan C
Ross D
Michael E
Rui G
Mahbubul H
Finnian H
Jethro H
Miss Anna H
Andrew H
Seyednima J
Kriss J
Jamie J
Dotun L
Alexander M
Adrian M
102345
123478
167891
201456
256789
298642
305678
315679
467890
489054
556732
567862
622456
650012
789123
798812
a) Show how binary search can by used to find the name of the student whose
number are 556732.
b) Can we use binary search to search for the ID number of Jamie.
c) You want to make a new version list ordered alphabetically by name. Choose
an algorithm for altering the directory. Use algorithm to reorder the first 10
entries above. Keep track of the number of comparison that is performed.
Question 4
Given the Graph bellow.
a) Assuming A is the source, find the lowest cost to get to any other point in the
graph.
b) Find the shortest path to get to J from A. Show all necessary working by
drawing a diagram state your shortest route and its length.
Question 5
Find the minimum spanning tree for the network below, showing
the order in which edges are selected:
a)
b)
using Kruskal’s algorithm,
using Prim’s algorithm starting from A.
Download