C/C++
文章平均质量分 82
csucbMIT
这个作者很懒,什么都没留下…
展开
-
5-1 Build A Binary Search Tree (30分)
5-1 Build A Binary Search Tree (30分) A Binary Search Tree (BST) is recursively defined as a binary tree which has the following properties: The left subtree of a node contains only nodes with ke原创 2016-10-28 16:56:51 · 1663 阅读 · 0 评论 -
4-1 Strongly Connected Components (17分)
使用Tarjan算法完成的题目,同时向图灵奖获得者致敬原创 2016-12-14 13:39:58 · 3181 阅读 · 0 评论 -
5-1 Insertion or Heap Sort (9分)
堆排序和插入排序之间的区别程序题原创 2016-12-14 13:37:43 · 1089 阅读 · 0 评论 -
4-1 Iterative Mergesort (9分)
一道简单的归并排序题原创 2016-12-14 13:35:35 · 4025 阅读 · 1 评论 -
Project 2
DFS算法的应用原创 2016-12-09 09:10:02 · 442 阅读 · 0 评论 -
最短路径问题(2)
承接上一篇博客,展示另一道PTA问题 4-2 Shortest Path [4] (25分) Write a program to find the weighted shortest distances from any vertex to a given source vertex in a digraph. If there is more than one mini原创 2016-11-25 09:48:54 · 673 阅读 · 0 评论 -
最短路径问题(1)
作为一名小白,最近学习了Dijkstra算法,对于最短路径的解有了一定的认识,从PTA的题目来说明Dijkstra算法 4-1 Shortest Path [3] (25分) Write a program to not only find the weighted shortest distances, but also count the number of differen原创 2016-11-25 09:46:04 · 1890 阅读 · 0 评论 -
5-1 File Transfer (30分)
5-1 File Transfer (30分) We have a network of computers and a list of bi-directional connections. Each of these connections allows a file transfer from one computer to another. Is it possible to原创 2016-11-15 21:17:05 · 355 阅读 · 0 评论 -
Topological Sort
Write a program to find the topological order in a digraph. Format of functions: bool TopSort( LGraph Graph, Vertex TopOrder[] ); where LGraph is defined as the following: typedef struct AdjVNode原创 2016-11-18 16:21:58 · 821 阅读 · 0 评论 -
树的深度
在学习数据结构树结构时,遇到求解树高度的问题,附上递归法求解树高度。 typedef struct TNode *BinTree; struct TNode{ int Key; BinTree Left; BinTree Right; }; int heightf(BinTree T) { int left = 0, right = 0; if(T -原创 2016-10-31 17:01:35 · 434 阅读 · 0 评论 -
4-1 Percolate Up and Down (20分)
4-1 Percolate Up and Down (20分) Write the routines to do a "percolate up" and a "percolate down" in a binary min-heap. Format of functions: void PercolateUp( int p, PriorityQueue H ); void Pe原创 2016-11-11 12:42:21 · 1275 阅读 · 0 评论 -
5-1 List Components (10分)
For a given undirected graph with N vertices and E edges, please list all the connected components by both DFS (Depth First Search) and BFS (Breadth First Search). Assume that all the vertices are num原创 2016-12-14 13:42:29 · 966 阅读 · 0 评论