码迷,mamicode.com
首页 >  
搜索关键字:冒泡排序 面试    ( 24179个结果
重构二叉树
时间限制:1 秒 内存限制:32 兆 题目描述: 输入某二叉树的前序遍历和中序遍历的结果,请重建出该二叉树。假设输入的前序遍历和中序遍历的结果中都不含重复的数字。例如输入前序遍历序列{1,2,4,7,3,5,6,8}和中序遍历序列{4,7,2,1,5,3,8,6},则重建二叉树并输出它的后序遍历序列。 输入: 输入可能包含多个测试样例,对于每个测试案例, 输入的第一行为一个整数n(1<=n<=1000):代表二叉树的节点...
分类:其他好文   时间:2014-05-07 06:00:58    阅读次数:443
travel the binary tree by level 5 ( from down to top and from left to right every level )
travel the binary tree by level 5 ( from down to top and from left to right every level ) 个人信息:就读于燕大本科软件工程专业 目前大三; 本人博客:google搜索“cqs_2012”即可; 个人爱好:酷爱数据结构和算法,希望将来从事算法工作为人民作出自己的贡献; 博客内容:tr...
分类:其他好文   时间:2014-05-07 05:40:19    阅读次数:401
从尾到头打印单链表
题目描述: 输入一个链表,从尾到头打印链表每个节点的值。 输入: 每个输入文件仅包含一组测试样例。 每一组测试案例包含多行,每行一个大于0的整数,代表一个链表的节点。第一行是链表第一个节点的值,依次类推。当输入到-1时代表链表输入完毕。-1本身不属于链表。 输出: 对应每个测试案例,以从尾到头的顺序输出链表每个节点的值,每个值占一行。...
分类:其他好文   时间:2014-05-07 05:28:33    阅读次数:259
jdk_Arrays类_排序方法_研究
private static void sort1(int x[], int off, int len) { // Insertion sort on smallest arrays //长度小于7,采用冒泡排序 if (len < 7) { for (int i=off; ioff && x[j-1]>x[j];...
分类:其他好文   时间:2014-05-07 05:14:35    阅读次数:279
CareerCup之1.2C风格字符串翻转
原文: Write code to reverse a C-Style String. (C-String means that “abcd” is represented as five characters, including the null character.) 译文: 写代码翻转一个C风格的字符串。(C风格的意思是"abcd"需要用5个字符来表示,包含末尾的 结束字符)...
分类:其他好文   时间:2014-05-07 05:12:34    阅读次数:265
替换字符串中的空格
剑指offer上的第二道题目,在九度OJ上测试通过,但还是有些问题,因为是用C语言实现的,因此,要提前开辟一个比较大的空间来存储输入的字符串。而如果在线测试系统的测试用例中字符串的长度大于该最大值的话,会报RE,但是九度OJ的测试用例没有大于我所设定的字符串的最大值。当然,这道题目用C++中的string类或java中的String类实现会更好,不需要担心输入字符串的长度。...
分类:其他好文   时间:2014-05-07 04:52:58    阅读次数:315
CareerCup之1.1字符串中字符判重
【题目】 Chapter 1 | Arrays and Strings 原文: 1.1 Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? 译文: 实现一个算法来判断一个字符串中的字符...
分类:其他好文   时间:2014-05-07 04:27:41    阅读次数:312
Cracking the coding interview
CareerCup 目录 Chapter 1 | Arrays and Strings 1.1  Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures? 1.2 Write co...
分类:其他好文   时间:2014-05-07 04:25:44    阅读次数:320
LeetCode合集
一 线性表 1.1  数组 1.1.1 Remove Duplicates from Sorted Array 1.1.2 Remove Duplicates from Sorted Array II 1.1.3 Search in Rotated Sorted Array 1.1.4 Search in Rotated Sorted Array II 1.1.5 Median of...
分类:其他好文   时间:2014-05-07 04:24:26    阅读次数:363
《Java程序员面试笔试宝典》之为什么需要public static void main(String[] args)这个方法
public staticvoid main(String[] args)为Java程序的入口方法,JVM在运行程序的时候,会首先查找main方法...
分类:编程语言   时间:2014-05-06 15:28:40    阅读次数:381
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!