I am a first year CS student at a University. My current assignment is about concurrency and the quicksort algorithm. As this is an assignment, I obviously wish to write the code myself to better understand how everything works. I therefore ask you to use pseudocode, and not java, when answering.
My program is supposed to start up at command line with three arguments; an in-file containing words, and out-filename, as well as a number (which will tell the program how many threads to use when sorting the in-file). When I start up the program, it is supposed to sort the words in the in-file using the quicksort algorithm and concurrency. Each thread is assigned a section (with a length of threads divided by number of words) of the array of words from the in-file. When every thread has finished sorting its section of the array, the program will append each array returned by the threads into one long, sorted array of words, and write them to the out-file.
My question is: where should I start? And at what point do I choose a pivot element in the array sections? Once I create the sections, or once the thread working on the section starts? Could you please give me a pseudocode example of the quicksort algorithm using threads?
Whew, that's a lot of questions! Thanks in advance
I am a first year CS student at a University. My current assignment is about concurrency and the quicksort algorithm. As this is an assignment, I obviously wish to write the code myself to better understand how everything works. I therefore ask you to use pseudocode, and not java, when answering.
My program is supposed to start up at command line with three arguments; an in-file containing words, and out-filename, as well as a number (which will tell the program how many threads to use when sorting the in-file). When I start up the program, it is supposed to sort the words in the in-file using the quicksort algorithm and concurrency. Each thread is assigned a section (with a length of threads divided by number of words) of the array of words from the in-file. When every thread has finished sorting its section of the array, the program will append each array returned by the threads into one long, sorted array of words, and write them to the out-file.
My question is: where should I start? And at what point do I choose a pivot element in the array sections? Once I create the sections, or once the thread working on the section starts? Could you please give me a pseudocode example of the quicksort algorithm using threads?
Whew, that's a lot of questions! Thanks in advance
การแปล กรุณารอสักครู่..
