diff --git a/ShellSort.cpp b/ShellSort.cpp new file mode 100644 index 000000000..bcda66d4e --- /dev/null +++ b/ShellSort.cpp @@ -0,0 +1,45 @@ +#include +using namespace std; + +int main() +{ + int size=10; + int array[size]; + // Input + cout<<"\nHow many numbers do want to enter in unsorted array : "; + cin>>size; + cout<<"\nEnter the numbers for unsorted array : "; + for (int i = 0; i < size; i++) + { + cin>>array[i]; + } + + // Sorting + for (int i = size/2; i>0 ; i=i/2) + { + for (int j = i; j =0; k=k-i) + { + if (array[k]