CS3413/Assignment8/code/disk.h
2023-12-02 23:16:56 -04:00

31 lines
616 B
C

#pragma once
typedef struct DiskRequest {
struct DiskRequest *next;
int position;
int time;
} DiskRequest;
typedef struct DiskQueue {
DiskRequest *head;
int size;
} DiskQueue;
typedef enum DiskDirection {
UP, DOWN
} DiskDirection;
DiskQueue *createDiskQueue();
void enqueue(DiskQueue *queue, int time, int position);
void delete(DiskQueue *queue, DiskRequest request);
DiskRequest *dequeue(DiskQueue *queue);
DiskRequest *findClosest(DiskQueue *queue, int position, double time);
void destroyDiskQueue(DiskQueue *queue);
int calcDistance(int position, int destination);