Microsoft Word - CS1FC16 Spring Term Coursework Part XXXXXXXXXX Department of Computer Science Summative Coursework Set Front Page Module Title: Fundamental of Computer Science Module Code: CS1FC16...

1 answer below »
I would like to ask you what costs this assignment.Some features must be added to the existing code and two different reports about the added features for the same code and plagiarism free. Each report need to be 4 pagesThank you


Microsoft Word - CS1FC16 Spring Term Coursework Part 2 2019-2020 Department of Computer Science Summative Coursework Set Front Page Module Title: Fundamental of Computer Science Module Code: CS1FC16 Lecturer responsible: Dr Martin Lester Type of Assignment: Project report (SORTING Part 2) Individual / Group Assignment: Individual Assignment Weighting of the Assignment: 7.5% Page limit/Word count: 4 pages Expected hours spent on this assignment: 20 Items to be submitted: Project report Work to be submitted on-line via Blackboard Learn by (date) Midday (12:00), 13th March 2020 Work will be marked and returned by 15 days post-submission NOTES By submitting this work, you are certifying that all figures, tables, equations, code snippets, artworks, and illustrations in this report are original and have not been taken from any other person's work, except where the works of others have been explicitly acknowledged, quoted, and referenced. You understand that failing to do so will be considered a case of plagiarism. Plagiarism is a form of academic misconduct and will be penalised accordingly. The University’s Statement of Academic Misconduct is available on the University web pages. If your work is submitted after the deadline, 10% of the maximum possible mark will be deducted for each working day (or part of) it is late. A mark of zero will be awarded if your work is submitted more than 5 working days late. You are strongly recommended to submit your work by the deadline as a late submission on one piece of work can impact on other work. If you believe that you have a valid reason for failing to meet a deadline then you should complete an Extenuating Circumstances form and submit it to the Student Support Centre before the deadline, or as soon as is practicable afterwards, explaining why. 2 1. Assessment classifications Criteria Analysis and insights into the problem definition, background and solution; report organisation, quality, explanations and presentation. Conclusion and referencing. First Class (>= 70%) Outstanding Upper Second (60-69%) Very high quality Lower Second (50-59%) Good quality Third (40-49%) Little or no evidence of correct implementation. Little or insignificant insight into problem. Significant omission of part of the problem. Poor referencing, little or no evidence of reflection of work. Pass (35-39%) Mostly poor work on all parameters mentioned above. Fail (0-34%) Unsatisfactory work 2. Assignment description The coursework is in two parts. In the first part, you wrote a program to implement an algorithm that sorts finite real numbers. You should now have received your mark and feedback for the first part. In this part of the coursework, the second part, you must extend your program to sort all floating point objects. The floating-point objects are: real numbers (including “positive” zero), negative zero, negative infinity, positive infinity, and Not-a-Number objects (NaNs). You must also give a theoretical analysis of the sorting algorithm you used by formulating and solving a recurrence relation to give the worst-case asymptotic time complexity for the algorithm in big-O notation. You are not required to include any empirical timing information or graphs, or an archive of source code. For most of these floating-point objects, there is an obvious total order that your sorting algorithm ought to respect. Note that negative zero should be treated as less than positive zero and that positive/negative infinity should be treated greater than/less than all real numbers respectively. It is not obvious what you should do with NaNs. You can choose how your sorting program handles NaNs, but whatever choice you make, you must implement a total order over all floating-point objects, which must treat all distinct NaNs as distinct objects. Note that it will be insufficient to rely 3 solely on the default floating-point equality and comparison operations in most programming languages, as these usually follow the IEEE standard, which specifies that all NaNs are unequal to themselves. Write a report that describes the sorting algorithm in English and in pseudo code. Give the source code of the implemented sorting algorithm and test runs. Each test run should show the input list of unsorted data and the output list of sorted data. Each test run must prove that the sorting routine has moved data from a wrong position to a correct position. The report should also state the worst-case theoretical time complexity of the algorithm and show how you derived this. You may reuse any relevant content from your submission to the first of the coursework for this second part. If you did all of the above for the first part of the coursework, feel free to resubmit the same report for this second part. You will not be penalised for including any information that was also needed for the first part. Additional information Your report must be submitted to BlackBoard as a PDF file. No other format is acceptable. Other formats will earn reduced marks. Marks will be reduced to zero if the BlackBoard document is unreadable. 3. Assignment submission requirements Front page of the submission Module Code: CS1FC16 Assignment report Title: SORTING Part -2 Student Number (e.g. 25098635): Date (when the work completed): Actual hrs spent for the assignment: Assignment evaluation (3 key points): Content of the required work A PDF file report. 4 4. Marking scheme Criteria Mark % Available Actual Mark Comment Report is a PDF file 10 Can sort data with at least one negative zero 10 Can sort data with at least one negative infinity 10 Can sort data with at least one positive infinity 10 Can sort data with at least one NaN 10 Can sort data with at least two different NaNs 10 Can sort data with at least three different NaNs 10 States worst-case time order 10 Solves a recurrence relation for worst-case time order 10 Bonus for original work or conventional work done exceptionally well 10 Total mark 100
Answered Same DayMar 06, 2021

Answer To: Microsoft Word - CS1FC16 Spring Term Coursework Part XXXXXXXXXX Department of Computer Science...

Neha answered on Mar 10 2021
129 Votes
51653/1.1.png
51653/1.2.png
51653/1.3.png
51653/1.4.png
51653/1.5.png
51653/1.6.png
51653/2.1.1.png
51653/2.1.2.png
51653/2.2.1.png
51653/2.2.2.png
51653/2.3.1.png
51653/2.3.2.png
51653/2.4.1.png
51653/2.4.2.png
51653/2.5.1.png
51653/2.5.2.png
51653/2.6.1.png
51653/2.6.2.png
51653/main (1).c
#include
#include
#include
#include
#include
#define MAX_NUMBER 25
5 //max size for array
//selection sort to sort the array. Array and its size is passed in this function
void selectionSort(float arr[], int n)
{
int i, j;
int min;
// for loop to run all the values of array
for (i = 0; i < n-1; i++)
{
min = i;
for (j = i+1; j < n; j++)
if (arr[j] < arr[min])
min = j;
float *xp = &arr[min];
float *yp = &arr[i];
// swap the values if min value is found
float temp = *xp;
*xp = *yp;
*yp = temp;
}
}
//main method which will be called as the program starts
int main()
{
char arr[MAX_NUMBER];
FILE * myfile;
float carr[MAX_NUMBER];
//open file and read the values
myfile =fopen("input.txt", "r");
//create file to save the sorted list
FILE *fp;
fp = fopen("output.txt", "w"); // file for storing sorted numbers
// if file doesn't exist then this line will be printed
if(NULL == myfile){
printf("file doesn't exist\n");
exit(0);
}
//this will check for the data of file whether it is empty or not
if(NULL != myfile){
fseek (myfile, 0, SEEK_END);
if (ftell(myfile)==0){
printf("file is empty\n");
return 0;
}
fseek(myfile,0,SEEK_SET);
}
size_t i = 0 ;
int max;
while (fscanf(myfile, "%s", &arr[i]) == 1){
carr[i] = atof(&arr[i]);
i++;
max = i;
}
for (i = 0; i < max; i++){
fscanf(myfile, "%f", &carr[i]);
}
clock_t t;
t = clock();
selectionSort(carr, max);
// this code will check for the time it used to sort the array
double time_taken = (((double)t)/CLOCKS_PER_SEC)* 1000;
fprintf(fp, "Time taken is: %.2f\n", time_taken );
for ( i = 0; i < max; i++ ){
fprintf(fp, "%g ", carr[i]);
}
//after finishing all the operations file will be closed
fclose(myfile);
fclose(fp);
return 0;
}
51653/Report.docx
Selection Sort
Problem Definition
Sort the values stored in a file using selection sort and store the sorted list in a file
Background
Selection sort is an improved version of the bubble sort. We have to make just one exchange for every comparison we do. There will be n-1 comparisons for n elements. The selection sort tries to find the largest values as it passes and once the pass is completed, it is placed in a proper location. After completing the first pass, the largest item reaches its correct place and after the second comparison, the second largest number finds its correct place.
Solution
The selection sort is one of the easiest sorting algorithms. This algorithm is based on the in-place comparison-based algorithm. The basic idea of selection sort is to loop over the indices of the array. For every index it finds, it gets the index of the minimum value and swap it. The length and indices of the array are equal (Jadoon, Sultanullah, Salman Faiz Solehria, and Mubashir Qayum). The loop contains 2 lines of code which are executed to get the sorted list so ideally it means 2n lines are executed for the complete code. But this statement is false. For each swap function there are three lines of code which are executed and hence its time remains constant. To find the number of lines executed to find the index of minimum, we have to find out the loop which is called for this value. It completely depends on the size of the subarray which is iterated.
Pseudocode
1. Read the file
2. Traverse through each value of the array
3. Assume that first number is the smallest
4. Find the smallest number out of the rest and compare it with the first number
5. If new number is smaller, swap it with the first number and try to find next smaller number
6. Repeat the steps 3 and 4 until the array becomes empty
It is known as selection...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here