I would like to hire a Greek Translator

预算 €30 - €250 EUR
竞标 3
平均竞标 €35
状态 关闭

The problem concerns sorting a large array in-memory using concurrent threads. One approach is the


(a) partition the array into N chunks of near-equal size, where N is a power of two.

(b) in parallel, sort each chunk, using a standard sorting technique, e.g. insertion sort.

(c) while there is more than one chunk, merge pairs of chunks in parallel.

For example, suppose the original array contains 16 entries, and we want to use up to N=4 threads.

Initial array: [8, 9, 2, 5, 11, 4, 19, 7, 13, 6, 16, 3, 19, 1, 10, 14]

We subdivide the array into four (= 16/4) chunks; in practice this does not involve copying the array, but

rather allocating a range of indices to each of four threads:

Array chunks: [[8, 9, 2, 5], [11, 4, 19, 7], [13, 6, 16, 3], [19, 1, 10, 14]]

Next, each thread sorts its chunk in-place.

Sorted chunks: [[2, 5, 8, 9], [4, 7, 11, 19], [3, 6, 13, 16], [1, 10, 14, 19]]

There are 4 > 1 chunks, so we perform a merge pass, using two threads to merge two pairs of adjacent

chunks into larger ordered chunks:

First merge pass: [[2, 4, 5, 7, 8, 9, 11, 19], [1, 3, 6, 10, 13, 14, 16, 19]]

There are still 2 > 1 chunks, so we perform a further merge pass, now using a single thread to merge the

remaining chunks:

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 16, 19]

The original array is now sorted.

To simplify the programming task, you can assume that the size of your input array and the number of

threads are both powers of 2. You program should create an array dynamically (219 should be a decent

size), populate the array with random values, and then sort it. For the “merge” phase, you will find it useful to

create a second array, of the same size as the first, and store the merged chunks in the merge array. Then

swap the merge array with the original array. Once sorting is complete, your program should check that the

array is sorted within the main body (using a simple sequential scan), before reporting the result of the check

on the terminal.

The number of threads to use can be fixed as a constant in your program. I recommend running 8 threads

as a starting point



  • 设置您的预算和时间范围
  • 简述您的提案
  • 通过工作获取报酬


  • stavroszarpas Profile Picture


    Athens,  Greece

    Im a Computer Science student in the Athens Univercity of Economics and Bussiness, and Im working with java and web developing.

  • PanosSof Profile Picture


    EVOSMOS,  Greece

    I am currently an IT student. I am in search of jobs to earn some experience on professional programming and earn some extra funds for my living. The languages i have worked on are: JAVA C++

  • ollylarkin Profile Picture


    United Kingdom

    I'm currently on a gap year after studying maths, further maths, physics and computing at college and was awarded 2 A*s and 2 As respectively. I am proficient in programming in Pascal, which I learnt in college, and have since started to develop my skills in c++, which I have taken too quite well. I will be attending Imperial College London in September 2017 to study electronic and information's engineering.