-
Notifications
You must be signed in to change notification settings - Fork 292
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lab_2 #1057
Lab_2 #1057
Conversation
Тесты какие-то не те. |
Исправил, жду дальнейших указаний w(°o°)w |
LibraryC/vector.c
Outdated
if (new_size == v->size) return; | ||
|
||
// Выделяем память для нового массива данных | ||
Data *new_data = (Data *)malloc(new_size * sizeof(Data)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
А если размер уменьшается, зачем выделять память?
std::cout << "\n"; | ||
|
||
// Performance test | ||
for (int i = 1 ; i <= 10000000 ; ++i) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это удалять нельзя.
Исправил \( ̄▽ ̄)/ |
LibraryC/vector.c
Outdated
// Проверка необходимости изменения емкости или размера вектора | ||
if (index >= vector->size) { | ||
// Определяем новый размер, который будет необходим | ||
vector_resize(vector, vector->size); // Увеличиваем размер вектора до необходимого |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Тут нужно было передать index + 1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Поправил код и добавил проверку, что дальше? |
Принято.
Задан ориентированный граф виде матрицы смежности. Написать программу для определения длины кратчайшего пути от одной вершины для другой. В первой строке входного файла записано количество вершин, номер стартовой вершины и номер финишной. В последующих строках идет описание матрицы смежности. Значения 0 в матрице обозначают отсутствие ребра. В выходной файл выводится длина кратчайшего пути. Если решения не существует – выводится IMPOSSIBLE. Программа должна использовать поиск в ширину на основе очереди. Входные данные
Выходные данные
|
Good?
<( ̄︶ ̄)>