Skip to content

Java OOP exam task (FernUniversität in Hagen, 2025) – compute the median of an odd-length array. Includes a simple sort-based solution and notes on an O(n) selection approach.

License

Notifications You must be signed in to change notification settings

Mithraiel/java-oop-exam-algorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

java-oop-exam-algorithms

Java OOP exam task (FernUniversität in Hagen, 2025) – compute the median of an odd-length array. Includes a simple sort-based solution and notes on an O(n) selection approach.

OOP2025 – Task 4: Algorithms (FernUniversität in Hagen)

This repository contains my Java solution for the algorithmic task from the Object-Oriented Programming (OOP) course (Course 63016) at FernUniversität in Hagen.

The task was to calculate the median of an odd-length integer array.
My solution uses a simple sort-based approach to determine the middle value of the dataset.


#Task Screenshot OOP Algorithms Task

This screenshot shows the original algorithmic task from the FernUniversität in Hagen (Course 63016).
The task belongs to the FernUniversität in Hagen and is shown here only for educational and illustrative purposes.
The Java solution in this repository was written by Michael Kain and received full marks for the programming part.


#Evaluation Screenshot OOP Evaluation Screenshot

Official evaluation sheet from FernUniversität in Hagen.
I achieved full points for the programming section, confirming correctness and functionality.
Displayed here only for transparency and documentation.


#Java Implementation

import java.util.Arrays;

/**
 * FernUniversität in Hagen – OOP2025 Task 4: Algorithms (Median)
 * Solution written by Michael Kain
 * Received full marks for the programming part
 */
public class MedianFinder {

    public static void main(String[] args) {
        int[] x = new int[]{
            6391,4209,963,7639,9523,6976,2415,7471,4444,8251,4551,8196,4314,3159,139,8708,6459,3591,
            1424,1828,3191,6828,9112,4014,2536,2354,3903,6556,864,1265,4364,3596,5423,6291,3240,
            8831,8821,193,6596,9583,8652,5863,408,4101,3961,9230,4946,5160,4927,3948,8195,9727,
            4025,8684,7259,1260,6625,28,55,2662,2425,1686,5129,3890,2967,8584,8372,1554,3643,1765,
            2804,327,5504,5125,7428,8612,1156,3709,9048,4781,5929,5690,9782,8880,3514,4750,329,
            113,1469,2754,423,5476,1413,48,6875,3205,6657,5818,2133,3685,7219,5595,6079,3019,7480,
            2466,6300,8627,5949,3764,1817,7829,2925,183,7770,6658,5477,2830,2675,2811,8599,9369,
            1590,591,9085,5458,4944,2094,981,1660,9190,1610,5661,9187,4573,7196,2225,4723,9759,
            2553,437,6213,1736,1485,7783,3370,5759,2452,3822,419,8836,8883,9633,2724,7892,5027,
            861,7103,6607,4429,7953,6412,8075,1527,1698,2618,5852,9055,9058,9922,9972,1552,4406,
            1157,9730,107,5367,2731,8548,3421,4665,8247,3837,1009,5396,6950,4149,9380,1834,850,
            5757,5669,1738,6404,9561,6945,8552,5874,7133,436,1026,422,9864,2652,1931,3628,8507,
            6420,6926,7699,7499,5736,5643,6145,6856,8005,2441,8182,3129,1663,9261,6074,4386,4503,
            8291,9783,8388,9993,9614,6317,9569,353,3861,9707,8403,6363,5751,6790,5337,8921,652,
            8310,584,7730,6777,5906,4714,1307,2773,6010,5869,2036,7807,4303,4109,1463,7815,6898,
            7331,9629,9064,7429,3941,636,2050,8111,969,2875,4083,6400,8749,1532,9562,7533,9154,
            2100,4470,4358,9640,8354,5304,1221,397,3777,822,3801,9161,6602,2345,9421,4040,8288,
            3374,738,9400,7678,6832,7658,4310,2293,5837,6082,8337,8101,5233,2526,7183,435,3792,
            5546,4664,4189,1275,2737,5885,3243,8095,4785,6974,4751,8926,2744,885,9129,7006,8892,
            4176,7646,2918,8491,5318,2563,9912,4005,17
        };

        Arrays.sort(x);                  // Step 1: Sort all values
        int median = x[x.length / 2];   // Step 2: Middle element = median

        System.out.println("Array length: " + x.length);
        System.out.println("Median index: " + (x.length / 2));
        System.out.println("Median value: " + median);
    }
}

About

Java OOP exam task (FernUniversität in Hagen, 2025) – compute the median of an odd-length array. Includes a simple sort-based solution and notes on an O(n) selection approach.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages