copy on git

This commit is contained in:
Thomas Rieg 2025-11-28 19:50:58 +01:00
commit 42653de246
205 changed files with 7459 additions and 0 deletions

47
libft/ft_priority_queue.h Executable file
View file

@ -0,0 +1,47 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 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