47 lines
No EOL
1.5 KiB
C
Executable file
47 lines
No EOL
1.5 KiB
C
Executable file
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_priority_queue.h :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: thrieg <thrieg@student.42mulhouse.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/11/19 14:51:31 by thrieg #+# #+# */
|
|
/* Updated: 2025/02/16 19:05:58 by thrieg ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#ifndef FT_PRIORITY_QUEUE_H
|
|
# define FT_PRIORITY_QUEUE_H
|
|
|
|
# include "libft.h"
|
|
|
|
typedef struct s_priority_queue_node
|
|
{
|
|
void *data;
|
|
size_t priority;
|
|
} t_priority_queue_node;
|
|
|
|
typedef struct s_priority_queue
|
|
{
|
|
t_priority_queue_node *nodes;
|
|
size_t size;
|
|
size_t capacity;
|
|
int (*compare)(void *, void *);
|
|
} t_priority_queue;
|
|
|
|
void ft_insert_pq(
|
|
t_priority_queue *pq,
|
|
void *data,
|
|
size_t priority);
|
|
|
|
t_priority_queue *create_priority_queue(
|
|
int capacity,
|
|
int (*compare)(void *, void *));
|
|
|
|
void *peek(t_priority_queue *pq);
|
|
|
|
void *dequeue(t_priority_queue *pq);
|
|
|
|
void free_pq(t_priority_queue *pq);
|
|
|
|
#endif |