mirror of
https://github.com/mfocko/blog.git
synced 2024-11-10 08:19:07 +01:00
49 lines
1.6 KiB
Markdown
49 lines
1.6 KiB
Markdown
---
|
|
id: seminar-03
|
|
title: 3rd seminar
|
|
description: |
|
|
Select sort implementation on arrays.
|
|
---
|
|
|
|
This assignment has two versions. For the light version you can get 0.5 K₡. For
|
|
the _full fat_ one 1 K₡. **You can choose only one of them**.
|
|
|
|
To both of them you are given some basic tests. You can also have a look at the
|
|
code used by the tests and use it to your advantage.
|
|
|
|
Details can be found in the doxygen comments included in the source files.
|
|
|
|
## Light version (`main_light.c`)
|
|
|
|
[Source](pathname:///files/pb071/bonuses/03/main_light.c)
|
|
|
|
For the light version you have 3 functions to finish:
|
|
|
|
1. `swap` - that swaps two ints passed by pointers.
|
|
2. `maximum` - that returns index of the biggest `int` in the array.
|
|
3. `select_sort` - that sorts passed array using Select Sort.
|
|
|
|
## Full fat version (`main.c`)
|
|
|
|
[Source](pathname:///files/pb071/bonuses/03/main.c)
|
|
|
|
For the full fat version you have 4 functions to implement:
|
|
|
|
1. `swap` - that swaps two variables passed by pointers.
|
|
2. `maximum` - that returns index of the biggest element in the array using the
|
|
comparator.
|
|
3. `select_sort` - that sorts passed array using Select Sort.
|
|
4. `int_comparator` - that is used for generic sort and maximum
|
|
|
|
To 2nd and 3rd function you are given a pseudocode that you can use to implement
|
|
it.
|
|
|
|
## Submitting
|
|
|
|
Ideally submit the assignment through the merge request. Step-by-step tutorial is
|
|
present [here](../mr). For setting assignee my xlogin is `xfocko`.
|
|
|
|
In case you do not want to experiment on GitLab, send me the source code via email,
|
|
but please prefix subject with: `[PB071/14][seminar-03]`
|
|
|
|
Deadline for the submission of the bonus is **March 27th 24:00**.
|