• 100% Satisfaction Guarantee

Ingo U, Software Engineer
Category: Homework
Satisfied Customers: 739
Experience:  Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
44076068
Ingo U is online now

# C++ QuestionBucket sort program.This file must contain

### Resolved Question:

C++ Question

Bucket sort program.

This file must contain the following:
Entire C++ directory structure tree
A fully tested and appropriately commented program

(Bucket Sort) A bucket sort begins with a one-dimensional array of positive integers to be sorted and a two-dimensional array of integers with rows subscripted from 0 to 9 and columns subscripted from 0 to n - 1, where n is the number of values in the array to be sorted. Each row of the two-dimensional array is referred to as a bucket. Write a method bucketSort that takes an integer array as an argument and performs as follows:

Place each value of the one-dimensional array into a row of the bucket array based on the value’s ones digit. For example, 97 is placed in row 7, 3 is placed in row 3 and 100 is placed in row 0. This is called a "distribution pass."

Loop through the bucket array row by row and copy the values back to the original array. This is called a "gathering pass." The new order of the preceding values in the single- subscripted array is 100, 3 and 97.

Repeat this process for each subsequent digit position (tens, hundreds, thousands, etc.).
On the second pass, 100 is placed in row 0, 3 is placed in row 0 (because 3 has no tens digit) and 97 is placed in row 9. After the gathering pass, the order of the values in the one-dimensional array is 100, 3 and 97. On the third pass, 100 is placed in row 1, 3 is placed in row 0 and 97 is placed in row 0 (after the 3). After the last gathering pass, the original array is now in sorted order.

Note that the two-dimensional array of buckets is ten times the size of the integer array being sorted. This sorting technique provides better performance than a bubble sort, but requires much more memory. The bubble sort requires space for only one additional element of data. This is an example of the space-time trade-off: The bucket sort uses more memory than the bubble sort, but performs better. This version of the bucket sort requires copying all the data back to the original array on each pass. Another possibility is to create a second two-dimensional bucket array and repeatedly swap the data between the two bucket arrays.

The BucketSort function should be implemented in a separate .cpp file from the main program with the function prototype specified in a .h file with the same name.

The main program should contin, in addition to the main program, and initialization function that will take an array and the array length as input parameters and initialize it to contain randomly generated numbers between 0 and 10,000.

The main program should:

a) declare and initialize an array of 16 integers (using the initialization function described above)
b) print out the contents of the array
c) call the sort function
d) print out the contents of the sorted array

I really need good comments to understand what's going on. Thank you!
Submitted: 3 years ago.
Category: Homework
Expert:  Josie-Mod replied 3 years ago.
Hi, I'm a Moderator for this topic. I've been working hard to find a professional to assist you right away, but sometimes finding the right professional can take a little longer than expected.

I wonder whether you're ok with continuing to wait for an answer. If you are, please let me know and I will continue my search. If not, please let me know and I will cancel this question for you. Thank you!
Customer: replied 2 years ago.
I would like to continue the search.
Expert:  Josie-Mod replied 2 years ago.
Thank you for your continued patience. We will continue the search for a professional for you.
Expert:  Josie-Mod replied 2 years ago.
Thank you for your patience, your business is very important to us, we are waiting on the professional with the right expertise to come online. Please let us know if you would like us to continue searching for a professional or if you would like us to close your question. Thank you for your understanding!
Customer: replied 2 years ago.
Should I offer more money? I can. please let me know.
Expert:  Josie-Mod replied 2 years ago.
Customer: replied 2 years ago.
I've got all 3 files; the main.cpp, another cpp and a header file (well commented) and I've uploaded to wikisend so all I'm needing the expert to do at this point is fix my code because I've got errors at run/compile time. The link can be found at

I really need the help. Thank you!
Customer: replied 2 years ago.
I really need your help on another posted problem where I've got all three files down (and really close to the right answer - I know it) but am getting some errors at compile/runtime. It's worth the price to me just to have you check it out and let me know what to fix - I've commented it pretty well:

The 2 cpp files and 1 header file are here:

Can you take the question? I really liked what you taught me on the last one and I need it since it's due tomorrow. I may be able to fix it, but I really need someone with your skills b/c I am not confident I can. Thanks!
Expert:  Ingo U replied 2 years ago.
Hi,
I took a look at your files; it looks like you're using Windows - how about the compiler? Visual Studio perhaps? If so, can you zip up the whole project folder and upload it? For one, you have an #include "BucketSort.h" but that files is not there.
Thanks,
Ingo U
Customer: replied 2 years ago.

Thank you so much! Yes, I'm using VS 2010 professional. I thought the header file was up there. I apologize. I've put a 7 zip of the entire project at:

Thank you!

Expert:  Ingo U replied 2 years ago.
OK, got it - but is it possible the files somehow got corrupted by 7zip? I'm getting 77 compile errors, much of it due to what looks like file corruption - for example, comments that should start with /* just start with *.
Can you try to just put everything in a windows zip file (compressed folder) to see if that changes anything at my end?
Thanks!
Customer: replied 2 years ago.

OK. I was getting errors as well with compiler. Not that many though, here's the windows zip file:

Thanks again.

Customer: replied 2 years ago.
This is a better version of the file - down to one error and one warning:

Expert:  Ingo U replied 2 years ago.

You need to spend \$3 to view this post. Add Funds to your account and buy credits.
Ingo U, Software Engineer
Category: Homework
Satisfied Customers: 739
Experience: Over 25 years experience in software development. Expert in Microsoft .Net, C#, C++, VB, SQL
Customer: replied 2 years ago.
That's excellent. Thank you very much!
Expert:  Ingo U replied 2 years ago.
Pleasure to work with you, AND THANKS FOR THE BONUS! Please feel free to request me directly at

if you'd like to work with me on a future project. If you do, just to be sure, put "FOR INGO ONLY" at the beginning of the subject line.

Regards,
Ingo
Customer: replied 2 years ago.
You as well and thanks again! Will do.

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

### What Customers are Saying:

• Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Previous | Next >
• Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
• This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
• Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
• I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
• Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
• Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
• He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX

• ### LogicPro

#### Satisfied Customers:

4925
Expert in Java C++ C C# VB Javascript Design SQL HTML
< Last | Next >

### LogicPro

#### Satisfied Customers:

4925
Expert in Java C++ C C# VB Javascript Design SQL HTML

### Manal Elkhoshkhany

#### Satisfied Customers:

4538
More than 5000 online tutoring sessions.

### Linda_us

#### Satisfied Customers:

3138
Post Graduate Diploma in Management (MBA)

### Chris M.

#### Satisfied Customers:

2602
Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)

### F. Naz

#### Satisfied Customers:

2126
Experience with chartered accountancy

### Bizhelp

#### Satisfied Customers:

1887
Bachelors Degree and CPA with Accounting work experience