31 lines
603 B
C
31 lines
603 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 peek(DiskQueue *queue);
|
|
|
|
DiskRequest *dequeue(DiskQueue *queue);
|
|
|
|
DiskRequest *findClosest(DiskQueue *queue, int position, double time);
|
|
|
|
void destroyDiskQueue(DiskQueue *queue);
|