- 博客(4)
- 收藏
- 关注
原创 重建二叉树
描述给定一棵二叉树的前序遍历和中序遍历的结果,求其后序遍历。输入输入可能有多组,以EOF结束。每组输入包含两个字符串,分别为树的前序遍历和中序遍历。每个字符串中只包含大写字母且互不重复。输出对于每组输入,用一行来输出它后序遍历结果。#include#include#define MAX 1000typedef struct BiTNode{ cha
2017-05-02 00:05:07 431
原创 快速排序代码
void quickSort(int *s, int left, int right) { if(left { int i,j,key; i = left; j = right; key = s[i]; while(j > i) {
2017-04-26 02:06:00 168
原创 461. Hamming Distance
The Hamming distance between two integers is the number of positions at which the corresponding bits are different.Given two integers x and y, calculate the Hamming distance.位运算,需要求两个整数之间的
2017-04-21 01:05:09 160
原创 算法竞赛入门经典 蛇形数组
一、一个比较笨的方法,计算出每次要前进的格数以及每次循环新的开始位置:#include#include#define MAX 10int main (){int a[MAX][MAX];int n,k=0;int i,j=0;scanf("%d",&n);int num = 1;while(1){//downfor(i=j;i{a[i
2017-04-20 01:47:19 340
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人