29 lines
564 B
C
29 lines
564 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);
|