Giter Club home page Giter Club logo

algo.pa1's Introduction

Algo.PA1

23-2 Algorithm Project_1

1. Objective

Your task is to implement a Min-Max-Median Priority Queue in C. Design a robust data structure that can efficiently find the minimum, maximum, and median integer elements. When the number of elements is even, the median is defined as the smaller of the two middle elements.

2. Required Functions

Implement the following functions:

  • void insert(int element): Inserts an integer element into the priority queue.

  • int delete_min(): Deletes and returns the minimum element.

  • int delete_max(): Deletes and returns the maximum element.

  • int delete_median(): Deletes and returns the median element.

  • int find_min(): Fetches but does not remove the minimum element.

  • int find_max(): Fetches but does not remove the maximum element.

  • int find_median(): Fetches but does not remove the median element.

3. Input Format and Examples

The input consists of a series of operations. The first integer denotes the number of operations to perform (ranging from 1 up to 500,000). Each subsequent line describes an operation, starting with a character indicating the operation type (I for insert, D for delete, F for find) followed by a character specifying the target (M for min, X for max, E for median), and if inserting, the integer to insert.

Example Input:
8
I 5
I 10
I 20
I 15
D M
F M
F X
F E

Expected Output:
10
20
15

algo.pa1's People

Contributors

shj1081 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.