divyang4481 / mipt-hw

Automatically exported from code.google.com/p/mipt-hw
0 stars 0 forks source link

task_08 DFS #218

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago

/baldin_dima/task08_dfs/

Original issue reported on code.google.com by dmitryba...@gmail.com on 23 Apr 2013 at 8:19

GoogleCodeExporter commented 9 years ago
0. То же самое: у Вас решение только для 
матрицы смежности. Нужно еще на списках 
смежности.

1. Решение неверное:

time_in 0, time_out 1, parent 0 
time_in 2, time_out 3, parent 4 
time_in 4, time_out 5, parent 18 
time_in 1, time_out 2, parent 1 
time_in 0, time_out 0, parent 0 
time_in 6, time_out 7, parent 13 
time_in 4, time_out 5, parent 20 
time_in 3, time_out 4, parent 2 
time_in 0, time_out 0, parent 0 
time_in 0, time_out 0, parent 0 
time_in 5, time_out 6, parent 3 
time_in 0, time_out 0, parent 0 
time_in 5, time_out 6, parent 7 
time_in 0, time_out 0, parent 0 
time_in 2, time_out 3, parent 4 
time_in 0, time_out 0, parent 0 
time_in 3, time_out 4, parent 15 
time_in 3, time_out 4, parent 2 
time_in 0, time_out 0, parent 0 
time_in 3, time_out 4, parent 2 

Почему: хотя бы потому, что все события 
имеют разное время. А у Вас есть события с 
одинаковыми временами.
Почитайте внимательно в Кормене, как 
определяются BFS/DFS.
И прежде чем сдавать попробуйте прогнать 
на маленьком примере. В общем-то, входные 
данные домашнего задания тоже можно 
разрисовать на бумажке - граф всего лишь из 
20 вершин и 30 ребер.

Решение не принято.

Original comment by aivyu...@gmail.com on 28 Apr 2013 at 8:03

GoogleCodeExporter commented 9 years ago
Сделал 2 версии, исправил ошибки

Original comment by dmitryba...@gmail.com on 2 May 2013 at 12:53

GoogleCodeExporter commented 9 years ago
Warnings:
dfs_matrix.cpp: In function ‘void read_graph(std::vector<std::vector<int, 
std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > 
>&, std::vector<clr, std::allocator<clr> >&, std::vector<int, 
std::allocator<int> >&, std::vector<int, std::allocator<int> >&, 
std::vector<int, std::allocator<int> >&)’:
dfs_matrix.cpp:18: warning: format ‘%d’ expects type ‘int*’, but 
argument 3 has type ‘size_t*’
dfs_matrix.cpp:18: warning: format ‘%d’ expects type ‘int*’, but 
argument 4 has type ‘size_t*’
dfs_matrix.cpp:18: warning: format ‘%d’ expects type ‘int*’, but 
argument 3 has type ‘size_t*’
dfs_matrix.cpp:18: warning: format ‘%d’ expects type ‘int*’, but 
argument 4 has type ‘size_t*’
dfs_matrix.cpp:20: warning: comparison between signed and unsigned integer 
expressions
dfs_matrix.cpp: In function ‘void print_vector(std::vector<std::vector<int, 
std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > 
>&, std::vector<int, std::allocator<int> >&, std::vector<int, 
std::allocator<int> >&, std::vector<int, std::allocator<int> >&)’:
dfs_matrix.cpp:73: warning: format ‘%d’ expects type ‘int’, but 
argument 3 has type ‘long unsigned int’
dfs_matrix.cpp:73: warning: format ‘%d’ expects type ‘int’, but 
argument 3 has type ‘long unsigned int’

Запускаю приложение. Оно подвисает. Я так и 
не понял, оно у Вас принимает данные из 
файла или через stdin. Если уж об этом пошел 
разговор, давайте договоримся, чтобы 
ввод-ввывод был через stdin/stdout.
То же самое требование к задаче BFS.

Original comment by aivyu...@gmail.com on 10 May 2013 at 8:38

GoogleCodeExporter commented 9 years ago

Original comment by dmitryba...@gmail.com on 18 May 2013 at 1:24

GoogleCodeExporter commented 9 years ago
Решение верное. Решение принято.

Original comment by aivyu...@gmail.com on 19 May 2013 at 11:30