bucket sort with EOF

Program needs to be done in C, Follow the instructions on the pdf

Get Help With a similar task to - bucket sort with EOF

Login to view and/or buy answers.. or post an answer
Additional Instructions:

→ Figure 1: Example of bucket sort for sorting numbers 29, 25, 3, 49, 9, 37, 21, 43. Numbers are distributed among bins (left image). Then, elements are sorted within each bin (right image). 1 with one another, you need to use function strcmp. can use bubble sort algorithm which is fairly easy to implement. Also, to compare strings assignment, you need to use any algorithm that you want. If you have no preference, you list is obtained by merging all the sorted buckets together. To sort each bucket in this list into a number of buckets. Each bucket is then sorted individually and then the sorted Bucket sort, or bin sort, is a sorting algorithm that works by distributing the elements of a 1 Bucket Sort and prints the sorted strings using printf function. followed by EOF from user through console, alphabetically sorts them using bucket sort, In this assignment, you are asked to write a program that gets a series of string chars 2 Buckets of Your Algorithm In order to implement bucket sort algorithm for strings, you need to have an array of buckets such that bucket is a C structure defined in the following way: struct bucket{ int minInitial; int maxInitial; int numWords; struct node* chainHead; }; and node is another C structure defined in the following way: struct node{ char* string; struct node* next; }; The array of buckets must be defined and initialized in the following way: struct bucket list[NUMBUCKS] = { ’a’, ’b’, 0, NULL, ’c’, ’c’, 0, NULL, ’d’, ’f’, 0, NULL, ’g’, ’k’, 0, NULL, ’l’, ’o’, 0, NULL, ’p’, ’r’, 0, NULL, ’s’, ’s’, 0, NULL, ’t’, ’z’, 0, NULL }; where NUMBUCKS represents 8. Therefore, you have eight buckets in your program. Each bucket contains four variables: � int minInitial: determines the minimum ASCII code of the initial letter which the strings in the bucket can start with. � int maxInitial: determines the maximum ASCII code of the initial letter which the strings in the bucket can start with. � int numWords: determines the number of strings placed in the bucket. � struct node* chainHead: points to a singly linked list which is a chain of nodes con- taining the strings in the bucket. 2 3 Program Input Assume that user enters a series of string chars followed by an EOF. Also, assume that every input string only contains letters of English Alphabet in lowercase format. Every string of chars that user passes to the program must be stored in the format of a char string. To allocate memory for storing a char string in memory, you can use expression char* aWord = (char *)malloc(strlen(inputString)+1); in which inputString is a char * pointing to the array of letters given by the user, strlen and malloc are functions defined in stdlib.h library (note that +1 in the mentioned expression allocates an extra memory cell for \0 that specifies the end of a char string). After allocating enough memory cells for each input string and copying the string into them, you need to allocate memory for storing a variable of type struct node containing a char * (pointing to the string) and a struct node * pointing to the next node in the linked list of appropriate bucket. 4 Program Output Your program must print out the sorted list of strings in an alphabetical order using printf function. 5 Submissions You need to submit a .zip file compressing the C source file(s) related to the assignment (.c files) along with a readme.txt file explaining which sorting algorithm you used for sorting each bucket and listing parts of the assignment has been implemented completely/partially. 3

Related Questions

Similar orders to bucket sort with EOF
7
Views
0
Answers
Java Labs on Array references and Array Lists
All instructions are provided on the attachments. Album lab preferably should be done ASAP, and library can wait 5 or so days. I attached the relevant powerpoint slides....
11
Views
0
Answers
Advancing Computer Science
Design and implement software solutions across multiple platforms....
5
Views
0
Answers
Advancing Computer Science
Programming project: Document the planning and development of software applications using industry standard tools, techniques, and processes....
8
Views
0
Answers
C++ program that will allow the creation and handling of hourglasses based on description provided.
-No global variables, other than constants! -All member data of your class must be private -Use the const qualifier on member functions wherever it is appropriate. -- failure to do this will likely cause compiler errors with my test programs -You ...