skeletton untested project
This commit is contained in:
commit
6fc620e8f4
187 changed files with 6584 additions and 0 deletions
47
libft/ft_priority_queue.h
Executable file
47
libft/ft_priority_queue.h
Executable 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue