Data Structures Lerax  v3.0-101-gb1f7
Opinionated Data Structures & Algorithms
Loading...
Searching...
No Matches
pqueue.h File Reference

Go to the source code of this file.

Data Structures

struct  PQueue
 A priority queue implementation using a binary heap. More...

Macros

#define PQUEUE_SIZE   10
#define HEAP_EMPTY_CELL   -1

Typedefs

typedef struct PQueue PQueue
 A priority queue.

Functions

PQueuepqueue_create ()
 Creates an empty priority queue.
void pqueue_insert (PQueue *pq, int x)
 Inserts an element into the priority queue.
int pqueue_extract_max (PQueue *pq)
 Extracts the maximum element from the priority queue.
void pqueue_increase_keys (PQueue *pq, int k, int v)
 Increases the key of an element in the priority queue.
int pqueue_maximum (PQueue *pq)
 Returns the maximum element in the priority queue without extracting it.
void pqueue_free (PQueue *pq)
 Frees the memory allocated for a priority queue.
void pqueue_print (PQueue *pq)
 Prints the elements of a priority queue to the console.
void pqueue_println (PQueue *pq)
 Prints the elements of a priority queue to the console, followed by a newline character.

Macro Definition Documentation

◆ HEAP_EMPTY_CELL

#define HEAP_EMPTY_CELL   -1

◆ PQUEUE_SIZE

#define PQUEUE_SIZE   10

    Copyright 2017-2025 Manoel Vilela

    Author: Manoel Vilela
   Contact: manoel_vilela@engineer.com

Organization: UFC


Typedef Documentation

◆ PQueue

typedef struct PQueue PQueue

A priority queue.