# Shell Sort Help

• 03-14-2013, 04:29 PM
ChrisChan
Shell Sort Help
Create a Java program with the following requirements:

REQUIREMENTS:
create a one dimensional array, the size will be based on the answer in the "Enter the number of values to be inserted". Example: if the user inputted 8, that means you must create a one dimensional array with the size of 8.
prompt the user to input number (the number of input based on the answer in the "Enter the number of values to be inserted"). save the numbers inputted in your one dimensional arrray.
ask the user for the required N-sort. please note of the two rules in N-sorting under shellsort: (1) zero (0) is not valid N and (2) it can only be ranging from one (1) up to the half of the inputted number of elements. so if the number of elements is 8, that means the valid N is ranging from 1 to 4 only.
after the user inputted the valid value for N, display the numbers inputted earlier and stored in your one dimensional array.
implement the shellsorting afterwards.

OUTPUT:

Enter the number of values to be inserted: 8

Type a number: 8
Type a number: 7
Type a number: 6
Type a number: 5
Type a number: 4
Type a number: 3
Type a number: 2
Type a number: 1

Enter the required N-sort: 7
The N is either less than or more than the required N sort value.

Enter the required N-sort: 0
The N is either less than or more than the required N sort value.

Enter the required N-sort: 4

Current content of the 4-sorted:

8 7 6 5
4 3 2 1

Sorted content of the 4-sorted:

4 3 2 1
8 7 6 5

thanks in advance guys :D
• 03-14-2013, 04:49 PM
Ronin
Re: Shell Sort Help
Quote:

Originally Posted by ChrisChan
Create a Java program with the following requirements...

Ok, done..... Oh wait! Was this a question?
• 03-14-2013, 04:51 PM
Ronin
Re: Shell Sort Help
Please show us your attempt so far, what you have tried and what you are struggling with.

Regards.
• 03-16-2013, 05:24 PM
ChrisChan
Re: Shell Sort Help
well im stuck at sorting
• 03-16-2013, 05:53 PM
JosAH
Re: Shell Sort Help
Quote:

Originally Posted by ChrisChan
well im stuck at sorting

Well, if you want sensible help better show us some of the relevant code (just the sort method will do fine).

kind regards,

Jos