This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

Hello Experts,

I need an algorithm on Parallel Insertion Sort.

Please provide some link/help.

thanks.

I need an algorithm on Parallel Insertion Sort.

Please provide some link/help.

thanks.

here it is:

http://en.wikipedia.org/wiki/Bubble_sort#Step-by-step_example

A parallel insertion sorting algorithm is at

http://www.cs.cmu.edu/~sca

Jose

tim_v, thanks for your reply, BUT, i am not requesting for sequential insertion sort, neither for Bubble sort.

JoseParrot, thanks for the link, BUT, it does not have sufficient information.

neither the algorithm is explained, nor model is specified for which algo is written there.

Please, i need Parallel Insertion sort or Parallem Shell sort for PRAM or HyperCube or Shuffle Exchange.

BTW, is Shell sort same as Insertion Sort ?

Please reply.

Jose

```
double insertionsort(int datasize)
{
double startTime=0, endTime=0, timee;
int v,i,j,temp;
int array[datasize];
//declaring the array for given datasize
for(i=0;i<datasize;i++)
{
array[i]= rand()%1000;
//printf(" %d",array[i]);
}
omp_set_num_threads(24);
startTime = timerval();
#pragma omp parallel for shared(array) private(i,temp)
for(i = (datasize-1); i > 0; i--)
{
if(array[i]<array[i-1])
{
temp = array[i];
array[i] = array[i-1];
array[i-1] = temp;
}
}
#pragma omp critical (array)
for(i = 2; i<=(datasize-1); i++)
{
j = i;
v = array[i];
while(v < array[j-1])
{
array[j] = array[j-1];
j--;
}
array[j] = v;
}
endTime = timerval();
timee = (endTime - startTime);
return timee;
}
```

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.

The trivial solution is to use OpenMP and declare a

parallel forin the first loop and let OpenMP do the things. A complete explanation is more complicated due the possible alternatives and contexts.Let me suggest first to understand well the principles of PRAM. A short presentation (which includes an example on insertion sort) can be downloaded at

www.nku.edu/~foxr/CSC464/c

For a deeper explanation on parallel programming, the book

Introduction to Parallel Algorithms(Wiley Series on Parallel and Distributed Computing) is a very good choice.About hypercubes, there are other considerations to take attention to, as data moving between processors, which can cancelate the gains of parallelizing if not well programmed.

As per your original question and second derived question seems you are looking for CREW PRAM, in which we should pay attention to the O(n log n) or O(log n) growth of memory space. If so, we should study a liitle bit on the subject before going to the final algorithm. A good start is the paper

On Sorting an Intransitive Total Ordered Set Using Semi-Heapat http://www.cse.fau.edu/~jiShell and Insertion sorting algorithms are different, not same things.

Below there are both algorithms in c like language with suggestions on to how to parallelize them by using OpenMP which is ease to obtain. Other parallel libraries will have similar sintax.

Jose

Open in new window