我参考《算法精解》中用单链表实现算法的代码,但在编写 main 函数时,运行出来会遇到图顶点插入出错,第一个顶点插入时会成功,但是第二个顶点之后似乎没有被插入图中,希望大神指教:
这里是 main 函数:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include "set.h"
#include "graph.h"
#include "example.h"
#include "graphalg.h"
#define DBL_MAX 20
int _match(const void *key1, const void *key2)
{
if(key1 == key2)
return 0;
else
return 1;
}
void _destroy(void *data)
{
free(data);
}
int main()
{
example();
return 0;
}
这里是 main 函数:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "list.h"
#include "set.h"
#include "graph.h"
#include "example.h"
#include "graphalg.h"
#define DBL_MAX 20
int _match(const void *key1, const void *key2)
{
if(key1 == key2)
return 0;
else
return 1;
}
void _destroy(void *data)
{
free(data);
}
int main()
{
example();
return 0;
}