This is an old revision of the document!


Highschool workshop - Introduction to D

Exercises

1. Array Median Element

Compute the median element of an unsorted integer array. For this, you will have to:

  1. Sort the array: implement any sorting algorithm you wish. At this link you will find a series of searching algorithms, each implemented in its own C file.
  2. Eliminate the duplicates: once the array is sorted, eliminating the duplicates is trivial. The array operations discussed, and more, can be found at this reference.
  3. Select the (n+1)/2th element.
  4. Write unittests to validate your implementation.

Use small functions to increase code readability and testing.

dss/workshop-01.1565779917.txt.gz ยท Last modified: 2019/08/14 13:51 by eduard.staniloiu
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0