Yeah, basically I'm asking if anyone could either walk me through a solution of a problem, or if it would be easier to simply do it themselves. I'm "taking" a C class, and would love it if I could get pointed in the right direction with a certain problem.

All of the sorting algorithms encountered so far in this course are known as Comparison
Sorting Algorithms because they order by directly comparing integers in a given array.
Other Sorting algorithms sort by different methods. Often, you are given an array and
asked to place the elements in their correct position. One such method is BucketSort.
Your task is to implement a very simple BucketSort. It is described below.

You are given the birth years of fifteen random people who were born in the twentieth
century (1900 - 1999). You are given the data as the following array, which is to be the
only argument used in your BucketSort function:
birthYears[] = {84, 51, 92, 72, 17, 62, 1, 16, 10, 28, 99, 71, 45, 18, 61};

Your function will have return type void and will work in the following manner:

• Create a 10x 10 array, which will represent the decades, and call it decade. Thus
decade[0][1] -> decade[0][9] will represent the 00’s, decade[1][0] -> decade[1][9]
will represent the 10’s, and so on up to decade[9][0] -> decade[9][9] which will
represent the 90’s.

• Initialize your array so that it contains only -1’s.

• Now go through the array birthYears and put each element in its appropriate
bucket, and in its appropriate index (WATCH THE INDICES) in your decade
array.

• Finally, trawl through decades, removing the elements one at a time and put back
into the array birthYears. They should already be in the correct order.

Yeah... just any guidance at all, that'd be great.

Recommended Answers

All 2 Replies

So, given the clear guidelines provided, what is your problem? If you are unclear about how to code this in C, then talk with your professor.

Just give it a try yourself. Come back here if you encounter any problems. Success!
Oh, btw the 21st century started on 31 december 2000 one second after 23:59 hour.So whole of the year 2000, you still lived in the 20th century!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.