Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

parallel sort - complexity calculating challange

Status
Not open for further replies.

samibami

Programmer
Oct 12, 2003
28
0
0
IL
hi there,
i'm programming an algorythm that sorts p sorted arrays into one array of size n.
this is done on parallel with p processors.
each processor gets an array of size n/p .

the algorythm:

1)each little array has a pointer to its first item which is the smallest (the little arrays are already sorted).

2)compare each pointer of each processor
and find the minimum.

3)the minimum is copied to the final sorted array.

4)the pointer of the processor that gave the minimum is moved to the next item.all other pointer are on hold.
if we cannot increment this pointer any more,then this processor is out of the loop.
5)goto stage 2
6)until array is full

what's the complexity calculation here?
i found that it is o(n). am i right?


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top