Skip to content

Commit

Permalink
changes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenaMaks committed Dec 25, 2024
1 parent 2d9175f commit 4248bcd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
7 changes: 2 additions & 5 deletions LibraryCPP/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ struct Queue
{
Vector* vector;
size_t front;
size_t rear;
size_t size;
};

Expand All @@ -14,7 +13,6 @@ Queue *queue_create()
Queue* queue = new Queue;
queue->vector = vector_create();
queue->front = 0;
queue->rear = 0;
queue->size = 0;
return queue;
}
Expand All @@ -40,10 +38,9 @@ void queue_insert(Queue *queue, Data data)
vector_delete(queue->vector);
queue->vector = new_vector;
queue->front = 0;
queue->rear = queue->size;
}
vector_set(queue->vector, queue->rear, data);
queue->rear = (queue->rear + 1) % vector_size(queue->vector);
size_t rear = (queue->front + queue->size) % vector_size(queue->vector);
vector_set(queue->vector, rear, data);
queue->size++;
}

Expand Down
5 changes: 2 additions & 3 deletions lab_three/lab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using namespace std;

void search(int** graph, int num_tops, const string &filename, int &start, int &end);
void search(int** graph, int num_tops, const string &filename, int start, int end);

int main(int argc, char* argv[]) {
if (argc != 3) {
Expand Down Expand Up @@ -38,7 +38,7 @@ int main(int argc, char* argv[]) {
return 0;
}

void search(int** graph, int num_tops, const string &filename, int &start, int &end) {
void search(int** graph, int num_tops, const string &filename, int start, int end) {

int* distances = new int[num_tops];
for (int i = 0; i < num_tops; i++) distances[i] = -1; //0 -1 -1 -1
Expand All @@ -58,7 +58,6 @@ void search(int** graph, int num_tops, const string &filename, int &start, int &
distances[i] = distances[now] + 1;
queue_insert(queue, i);
}
else queue_insert(queue, i);
}
}

Expand Down

0 comments on commit 4248bcd

Please sign in to comment.