Assignment title: Information
Soft20111 – Software Engineering
Richard Hibberd – 88356 Portfolio task #6 – v2015.2
Portfolio 6 – coding challenge
This task must be uploaded to your personal HG repository by 0845 on Monday 9th May 2016 (this
is just before the final lab; the shoot-out is timed runs during the lab on that day).
P6 is simply an exercise in writing efficient1 code; you will be assessed by the accuracy and speed
of your program in processing a number of test cases. Your code file p6.cpp should supply an
implementation for this function declared below; it should not declare nor implement a function
main()
Scoring is as follows and combines a mark for correct processing with a performance-related
bonus, where the timings for calls to this function are added together and scaled as a percentage
of the reference time. The reference time will be that returned by the function p6ACBC2, or the best
student time.
Correct processing is worth 8/15. A further 7 marks are available:
• +1 if the time is within 300% of the reference time (up to 4 times slower)
• +2 if the time is within 200% of the reference time (up to 3 times slower)
• +3 if the time is within 100% of the reference time (up to 2 times slower)
• +4 if the time is within 50% of the reference time
• +5 if the time is within 20% of the reference time
• +6 if the time is within 10% of the reference time
• +7 if the time is within 5% of the reference time (or faster)
• anything faster than the reference time, the 7 marks will be scaled pro rata3
You can use any source that will compile under gcc (g++) or clang; assembly language is allowed,
but not recommended - the reference code is exclusively C++. Experience suggests that the best
performance is likely to be achieved by careful analysis of the problem and design of the solution,
rather than tricksy tweaking of the code4.
1 In this case, 'efficient' means w.r.t time (or fast).
2 This will be provided as object code for OSX (clang), gcc and VC12 (VS2013)
3 In this case, the winning student version will be worth > 100% (>15/15)
4 though experience also suggests that the module leader is far from infallible
Soft20111 – Software Engineering
Richard Hibberd – 88356 Portfolio task #6 – v2015.2
Portfolio 6 – coding challenge
P6 is simply an exercise in writing efficient1 code; you will be assessed by the speed of your
program in processing a number of test cases. Your code file p6.cpp should supply an
implementation for the function declared below
std::list & p6(unsigned long int factoriseMe);
Do not address issues of process/thread allocation or other manipulations of processor resources –
this is about your C++
p6 - the function
The function returns (a reference to) a list of the prime factors of its parameter; it should reflect the
following constraints
• the list should be sequenced in descending order
• if the parameter is 0 or 1, the list should be empty
• any test of prime-ness must use values calculated as part of the function run-time (no
embedded or loaded look-up tables
• the parameter can be any value in the range 0 to numeric_limits::max()
A Jenkins job will be available to provide reference results and to test your implementation.