最近看老罗视频,做了一个简单的用户注册系统。用户通过网页(JSP)输入用户名、真名和密码,Servlet接收后通过JDBC将信息保存到MySQL中。虽然是个简单的不能再简单的东西,但麻雀虽小,五脏俱全,在此做一归纳和整理。下面先上源码:一、index.jsp
<%
String path = request.getContextPath();
String basePath = request.g...
分类:
数据库 时间:
2014-06-29 07:24:04
阅读次数:
366
【题目】
Given an array where elements are sorted in ascending order, convert it to a height balanced BST.
【题意】
给定一个已排序的数组(不存在重复元素),将它转换成一棵平衡二叉搜索树。
【思路】
由于平衡二叉树要求左右子树的高度差绝对值相遇等于1,也就是说左右子树尽可能包含相同数目节点。
则使用二分法来解本题即可。...
分类:
其他好文 时间:
2014-06-20 11:03:31
阅读次数:
246
【题目】
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
【题意】
判断二叉树是否是平衡二叉树
【思路】
平衡二...
分类:
其他好文 时间:
2014-06-20 11:02:54
阅读次数:
173
为算术语言(Arithmetic-Language)实现编译器和解释器
到目前,我们更注重的是语言本身的设计,即前端,没有涉及语言的编译器或解释器的实现,即后端。在这一节,我们将关注后端的实现,由抽象语法树(Abstract Syntax Tree,AST)定义的一种简单的算术语言。第一小节所展示的抽象语法树是基于联合类型的。
在下一章“解析文本”,我们还要回到这个示例,来构建这种语言的...
分类:
其他好文 时间:
2014-06-20 10:48:39
阅读次数:
203
1、
??
Recover Binary Search Tree
Two elements of a binary search tree (BST) are swapped by mistake.
Recover the tree without changing its structure.
Note:
A solution using O(n) space is pretty...
分类:
其他好文 时间:
2014-06-20 10:13:49
阅读次数:
243
【题目】
Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree {3,9,20,#,#,15,7},
3
/ 9 20
/ 15 7
return its b...
分类:
其他好文 时间:
2014-06-20 09:42:30
阅读次数:
224
1 #include 2 #include 3 using namespace std; 4 5
#define N 4 6 7 void fullarrange(char num[], int len, int index) { 8 if(index ==
len) { 9 ...
分类:
其他好文 时间:
2014-06-20 08:51:28
阅读次数:
293
先上用来生成Tree的JSON数据 [ { "id": "Root", "name":
"资源目录" }, { "id": "PF", "name": "批发价格", "parent": "Root" }, { "id": "PF93",
"name": "93#", "parent": "
分类:
其他好文 时间:
2014-06-13 13:49:33
阅读次数:
442
最早用天涯和cnblog的初衷在于他们最早和google合作,每天都能index里面的最新内容,但是发现这么多年以后,google已经在墙外。空间和所有内容已经丢linode的vps上去了,域名估计八成也是被墙了,届时用goddaddy的ipv6进行域名解析吧.
此致敬礼
分类:
其他好文 时间:
2014-06-13 13:35:09
阅读次数:
294
【题目】
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.
【题意】
将一个有序链表转换成平衡二叉树
【思路】
思路跟Convert Sorted Array to Binary Search Tree完全一样...
分类:
其他好文 时间:
2014-06-07 16:20:05
阅读次数:
287