摘要:
题目:输入一棵二元查找树,将该二元查找树转换成一个排序的双向链表。要求:不能创建任何新的结点,只调整指针的指向。举例: 10 / \ 转变 6 14 --> 4=6=8=10=12=14=16 / \ / \ 4 8 12 16定义的二元查找树结点的数据结构如下:struct BSTreeNode { int m_nValue; BSTreeNode *m_pLeft; BSTreeNode *m_pRight;};答:用二叉树的中序遍历#include "std... 阅读全文
摘要:
#include "stdafx.h"#include <iostream>#include <fstream>#include <queue>#include <stack>#include <Windows.h>using namespace std;typedef struct _Node{ int data; struct _Node *left; struct _Node *right; _Node() { data = 0; left = NULL; right = NULL; }}Node, *... 阅读全文
摘要:
#include "stdafx.h"#include <iostream>#include <fstream>#include <Windows.h>using namespace std;#define INFINITY 65535#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//*********************************邻接矩阵***********************************begin//邻接矩阵typedef st 阅读全文
摘要:
#include "stdafx.h"#include <iostream>#include <fstream>#include <Windows.h>using namespace std;#define INFINITY 65535#define MAX_VERTEX_NUM 20 //顶点最多个数#define LENGTH 5 //顶点字符长度//*********************************邻接表***********************************begintypedef char Vert 阅读全文