自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(16)
  • 收藏
  • 关注

原创 [编程题] 最大映射

时间限制:1秒空间限制:32768K有 n 个字符串,每个字符串都是由 A-J 的大写字符构成。现在你将每个字符映射为一个 0-9 的数字,不同字符映射为不同的数字。这样每个字符串就可以看做一个整数,唯一的要求是这些整数必须是正整数且它们的字符串不能有前导零。现在问你怎样映射字符才能使得这些字符串表示的整数之和最大? 输入描述: 每组测试用例仅包含一组数据,每组数据第一...

2018-08-12 00:01:30 725

原创 Shortest Path [3]

Write a program to not only find the weighted shortest distances, but also count the number of different minimum paths from any vertex to a given source vertex in a digraph. It is guaranteed that all

2016-11-28 10:54:37 2398

原创 4-2 Shortest Path [4]

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 minimum path from v to w, a path with the fewest number of edge

2016-11-28 00:46:52 2075

原创 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-19 23:41:10 1060

原创 File Transfer

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 send a file from any computer

2016-11-06 19:57:25 683

原创 Build A Binary Search Tree

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 keys less than the node's key.The righ

2016-10-23 10:53:37 1416

原创 CheckBST[1]

Given a binary tree, you are supposed to tell if it is a binary search tree. If the answer is yes, try to find theKKK-th largest key, else try to find the height of the tree.Format of function:

2016-10-22 16:35:08 3217 1

原创 Tree Traversals Again

An inorder binary tree traversal can be implemented in a non-recursive way with a stack. For example, suppose that when a 6-node binary tree (with the keys numbered from 1 to 6) is traversed, the stac

2016-10-15 23:17:14 317

原创 Isomorphic

Two trees, T1 and T2, are isomorphic ifT1 can be transformed into T2 by swapping left and right children of (some of the) nodes inT1. For instance, the two trees in Figure 1 are isomorphic because

2016-10-15 17:15:12 3422

原创 Level-order Traversal

Write a routine to list out the nodes of a binary tree in "level-order". List the root, then nodes at depth 1, followed by nodes at depth 2, and so on. You must do this in linear time.Format of func

2016-10-15 16:08:57 3280

原创 Pop Sequence

Given a stack which can keep MMM numbers at most. Push NNN numbers in the order of 1, 2, 3, ..., NNN and pop randomly. You are supposed to tell if a given sequence of numbers is a possible pop s

2016-10-07 13:04:46 285

原创 Evaluate Postfix Expression

Write a program to evaluate a postfix expression. You only have to handle four kinds of operators: +, -, x, and /.Format of functions:ElementType EvalPostfix( char *expr );where expr points to

2016-10-07 11:27:26 2537

原创 Two Stacks In One Array

Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.Format of functions:Stack CreateStack( int Ma

2016-10-07 00:21:51 3252

原创 Deque

A "deque" is a data structure consisting of a list of items, on which the following operations are possible:Push(X,D): Insert item X on the front end of deque D.Pop(D): Remove the front item from

2016-10-06 23:33:23 545

原创 Add Two Polynomials

Write a function to add two polynomials. Do not destroy the input. Use a linked list implementation with a dummy head node. Note: The zero polynomial is represented by an empty list with only the dumm

2016-10-05 23:05:55 2208

原创 Reverse Linked List

Write a nonrecursive procedure to reverse a singly linked list in O(N)O(N)O(N) time using constant extra space.Format of functions:List Reverse( List L );where List is defined as the follow

2016-10-05 23:01:42 991

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除