EEEN20010 University College Dublin Bubble Sort Algorithm Project


University College Dublin

Question Description

I need an explanation for this C Programming question to help me study.


Please write a program by using C language and use codeblocks to write the program. Also, please while writing the program add comments on every step you take, explaining the steps and functions that you used ,for example( printf is used to print the following statement...) and so on .

Thank you 😀

Unformatted Attachment Preview

EEEN20010 Computer Engineering “The bubble sort algorithm” (bubsort) You are expected to demonstrate a working C program according to the description below. Your program should be uploaded (via Brightspace) before the deadline. You must use the file name specified in the problem description below. Late submissions will not be corrected and will receive zero credit, so even if your program is not running correctly, you should submit your “best attempt”. Program description A common application in programming is that of reading data records from a text file and sorting the records into alphabetical order. In this programming assignment, you are asked to read in student names and marks from a short data file, and to provide an output with the names in alphabetical order. You may assume a maximum number of 100 students. The files raw1.txt and raw2.txt are provided as examples of files containing records to be sorted. You should output the sorted records to a file called sorted.txt. For example, the file raw1.txt is as follows: Sheridan, Donal Cahill, Catherine Byrne, Geraldine Ryan, Elizabeth Lawlor, Adrian 52 78 45 63 76 In this case, the output file sorted.txt should look like: Byrne, Geraldine Cahill, Catherine Lawlor, Adrian Ryan, Elizabeth Sheridan, Donal 45 78 76 63 52 The name of the input file should be provided to your program by the user, as follows (user input in bold): Enter name of file containing student records to be sorted: raw1.txt The Bubble Sort Algorithm In the bubble sort algorithm, a pass through a data set consists of comparing adjacent pairs of elements and effecting a swap if two elements are out of order (as shown in Table 1). Each such pass will ensure that at least one element will be in its correct position. The process is repeated until the list is fully sorted. Table 1: Bubble sort algorithm 0 0:SMITH 1 1:JONES 2 2:BYRNE 33:REILLY Initial state of data set 0:JONES 1:SMITH 2:BYRNE 3:REILLY Interchange after comparing slots 0 and 1 0:JONES 1:BYRNE 2:SMITH 3:REILLY Interchange after comparing slots 1 and 2 0:JONES 1:BYRNE 2:REILLY 3:SMITH Interchange after comparing slots 2 and 3 Deliverables File name bubsort.c Description C source code as described above YOUR PROGRAM WILL NOT BE GRADED UNLESS IT HAS THE CORRECT FILENAME STUDENTS MUST WORK INDEPENDENTLY. PROGRAMS WILL BE EXAMINED FOR EVIDENCE OF COPYING. COPYING OR ALLOWING YOUR WORK TO BE COPIED WILL RESULT IN A GRADE OF “NM” BEING ALLOCATED FOR THE ASSIGNMENT. Cavanagh, Tom Phill, Lewis Schuldt, Travis Rose, Joe Jenkins, Ken Flynn, Neil Lloyd, Sam Kastl, Johnny Faison, Donald Chun, Charles Miller, Christa Maschio, Robert Chalke, Sarah Wright, Aloma McGinley, John Reyes, Judy Reid, Tara Braff, Zach Klebba, Martin Graham, Heather Stevenson, Geoff 40 1 17 64 35 81 61 29 6 55 76 39 30 17 42 56 51 41 40 85 29 Sheridan, Donal Cahill, Catherine 78 Byrne, Geraldine 45 Ryan, Elizabeth Lawlor, Adrian 52 63 76 ...
Purchase answer to see full attachment
Student has agreed that all tutoring, explanations, and answers provided by the tutor will be used to help in the learning process and in accordance with Studypool's honor code & terms of service.

Final Answer

Actually, the program is ready. The file you should submit is bubsor...

Borys_S (7940)
Boston College

Thanks for the help.

Outstanding. Studypool always delivers quality work.

Tutor was very helpful and took the time to explain concepts to me. Very responsive, managed to get replies within the hour.