2023-11-28 20:33:23 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
typedef struct DiskRequest {
|
2023-11-28 21:02:49 -04:00
|
|
|
struct DiskRequest *next;
|
2023-11-28 20:33:23 -04:00
|
|
|
int position;
|
|
|
|
int time;
|
|
|
|
} DiskRequest;
|
|
|
|
|
|
|
|
typedef struct DiskQueue {
|
2023-11-28 21:02:49 -04:00
|
|
|
DiskRequest *head;
|
2023-11-28 20:33:23 -04:00
|
|
|
int size;
|
|
|
|
} DiskQueue;
|
|
|
|
|
|
|
|
typedef enum DiskDirection {
|
|
|
|
UP, DOWN
|
|
|
|
} DiskDirection;
|
|
|
|
|
|
|
|
DiskQueue *createDiskQueue();
|
|
|
|
|
2023-11-28 21:02:49 -04:00
|
|
|
void enqueue(DiskQueue *queue, int time, int position);
|
2023-11-28 20:33:23 -04:00
|
|
|
|
2023-12-02 21:30:51 -04:00
|
|
|
void delete(DiskQueue *queue, DiskRequest request);
|
2023-11-28 20:33:23 -04:00
|
|
|
|
|
|
|
DiskRequest peek(DiskQueue *queue);
|
|
|
|
|
|
|
|
DiskRequest dequeue(DiskQueue *queue);
|
|
|
|
|
2023-11-28 21:02:49 -04:00
|
|
|
DiskRequest *findClosest(DiskQueue *queue, int position, double time);
|
2023-11-28 20:33:23 -04:00
|
|
|
|
|
|
|
void destroyDiskQueue(DiskQueue *queue);
|