0

i need parallel program that can sort 500,1000,1500,2000 numbes in bubble sort,selection sort,insertion sort and merge sort.

3
Contributors
2
Replies
9
Views
3 Years
Discussion Span
Last Post by mike_2000_17
0

You need to create threads in order to do parallel program. How to do that depends on the operating system you are using, or threading extensions of c++11 standards. A third option is to use boost threading library. If you are using a pretty new compiler, such as most recent version of g++ it will support c++11 threading.

0

I think that you will have a bit of problems because of all the algorithms you cited, only "merge-sort" is parallelizable, AFAIK. In any case, parallelizing an algorithm is very tricky business, especially if your aim is to compare the performance. In fact, the overhead coming from synchronization is generally so significant, even in really good parallel sort algorithms, that you won't be able to beat a single-threaded lean implementation like std::sort for data sets smaller than 100 thousand elements or more. That's how significant the overhead is.

I would guess that you must have misunderstood the question because I doubt very much that anyone would ask you to write a parallel bubble sort algorithm. So, I'm not sure what that "parallel" word really refers to.

In any case, we won't do your homework for you. You have to show that you are making efforts to solve this problem by yourself and ask us questions about specific problems that you are encountering with your code.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.