Create a programming task related to algorithms and data structures,…
- User
Assistant: User: Create a programming task related to algorithms and data structures, similar to LeetCode tasks. Follow this scenario:
codeThe task description should involve processing a dataset (e.g., an array of numbers) where a specific statistical measure (average, median, mode, etc.) needs to be calculated. Input: A collection of numerical values. Output: A statistical measure calculated from the collection. Provide several examples of input and expected output with explanations. Propose a function with a typical signature that will solve the task.Assistant:
- Assistant
Task Description
Title: Find the Median of a Dataset
Description:
Given an array of integers representing a dataset, your task is to calculate the median of the numbers. The median of a dataset is the middle number when the numbers are sorted in non-decreasing order. If the number of elements in the dataset is odd, the median is the middle element. If the number of elements is even, the median is the average of the two middle elements.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.