【题目】
Given two binary trees, write a function to check if they are equal or not.
Two binary trees are considered equal if they are structurally identical and the nodes have the same value.
【题意】
判断了两个二叉树是否相等
【思路】
递归...
分类:
其他好文 时间:
2014-06-02 11:03:03
阅读次数:
205
【题目】
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).
For example, this binary tree is symmetric:
1
/ 2 2
/ \ / 3 4 4 3
But the following is not:
1
/ 2 2
\ 3 3
No...
分类:
其他好文 时间:
2014-06-02 10:56:14
阅读次数:
237
【题目】
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 straight forward. Could you devise a constant space solution?
confused what "{1,#,2,3}" ...
分类:
其他好文 时间:
2014-06-02 10:38:17
阅读次数:
246
问题描述
求 1+2+ … +n ,要求不能使用乘除法、 for 、 while 、 if 、 else
、 switch 、 case 等关键字以及条件判断语句。
实际意义不大,题目涉及的知识还是不错的!
方法1
用构造函数求解。
#include
using namespace std;
class Plus
{
public:
Plu...
分类:
其他好文 时间:
2014-06-02 10:29:11
阅读次数:
208
Given a linked list, determine if it has a
cycle in it.Follow up:Can you solve it without using extra
space?求链表是否有环的问题,要考虑链表为空的情况,定义一个快指针和一个慢指针,如果快指针和...
分类:
其他好文 时间:
2014-06-02 08:05:16
阅读次数:
255
Given a linked list, return the node where the
cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it
without using extra space?借用博...
分类:
其他好文 时间:
2014-06-02 07:32:33
阅读次数:
291
问题:
Write a program to solve a Sudoku puzzle by filling the empty cells.
Empty cells are indicated by the character '.'.
You may assume that there will be only one unique solution.
...
分类:
其他好文 时间:
2014-06-02 05:25:23
阅读次数:
295
【AES】
一种对称加密算法,DES的取代者。
加密相关文章见:
【代码】
代码比较多,有一部分非本文章内容代码,具体自己看吧。
package com.uikoo9.util.encrypt;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.Secure...
分类:
编程语言 时间:
2014-06-02 04:49:21
阅读次数:
426
class Solution {
public:
void swap(int &a,int &b)
{
int t=a;
a=b;
b=t;
}
void ksort(int l,int h,int a[])
{
if(h<l+2)
return;
int e=h,p=l;
while(...
分类:
其他好文 时间:
2014-06-02 03:01:26
阅读次数:
206
Ubuntu下Codeblocks+wxWidgets编程。学生信息管理系统...
分类:
其他好文 时间:
2014-06-02 02:25:59
阅读次数:
326