码迷,mamicode.com
首页 >  
搜索关键字:冒泡排序 面试    ( 24179个结果
CareerCup之1.7 Set Matrix Zeroes
【题目】 原文: 1.7 Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0. 译文: 写一个函数处理一个MxN的矩阵,如果矩阵中某个元素为0,那么把它所在的行和列都置为0. 【分析】 【思路一】 遍历一次矩阵...
分类:其他好文   时间:2014-05-15 12:27:37    阅读次数:293
javascript中对字符串的操作总结
原文:javascript中对字符串的操作总结没听过一句话吗?程序员的世界,不处理字符串就是处理数组。这是群里的一位前辈和我说的,显然这和我之前理解的DOM是javascript的核心的不同的,看了几个面试题的内容,感觉前辈说的话非常的有道理,因此总结下,javascript中对字符串的操作。Str...
分类:编程语言   时间:2014-05-15 09:57:27    阅读次数:369
UVA之1121 - Subsequence
【题目】 A sequence of N positive integers (10 N , each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the subse...
分类:其他好文   时间:2014-05-15 07:58:17    阅读次数:329
冒泡排序
算法原理: 第一趟:从j=0开始,比较相邻的两个数a[j]和a[j+1],如果a[j]>a[j+1],则交换他俩的位置,这样会将大的数放在后面。每比较一次让j++,当j=length-1时终止。 这样一趟走完,最后面的数应该是最大数。 那么第二趟,还是从0开始,只不过这次j的终止条件是j=length-2。第二趟走完,最后两个数应该是数组中最大的两个数并且有序排列。 重复若干趟,直到j的终...
分类:其他好文   时间:2014-05-15 07:56:49    阅读次数:238
C/C++ 数据结构之算法(面试)
数据结构中的排序算法。排序算法的相关知识:(1)排序的概念:所谓排序就是要整理文件中的记录,使之按关键字递增(或递减)次序排列起来。(2)稳定的排序方法:在待排序的文件中,若存在多个关键字相同的记录,经过排序后这些具有相同关键字的记录之间的相对次序保持不变,该排序方法是稳定的。相反,如果发生改变,这...
分类:编程语言   时间:2014-05-14 23:06:00    阅读次数:725
javascript中对字符串的操作总结
没听过一句话吗?程序员的世界,不处理字符串就是处理数组。这是群里的一位前辈和我说的,显然这和我之前理解的DOM是javascript的核心的不同的,看了几个面试题的内容,感觉前辈说的话非常的有道理,因此总结下,javascript中对字符串的操作。String类型首先字符串类型是基本类型,但是在这里...
分类:编程语言   时间:2014-05-14 22:37:27    阅读次数:374
LeetCode 010 Regular Expression Matching
【题目】 Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. The matching should cover the entire input string (not partial). The function prototype shoul...
分类:其他好文   时间:2014-05-14 21:36:52    阅读次数:348
LeetCode 008 String to Integer (atoi)
【题目】 Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases. Notes: It is intended for this problem to be s...
分类:其他好文   时间:2014-05-14 21:00:57    阅读次数:304
LeetCode 007 Reverse Integer
【题目】 Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 【题意】 反转int型整数,输出的也是int型的整数 【思路】 如要考虑两种特殊情况: 1. 类似100这样的整数翻转之后为1 2. 翻转之后的值溢出该如何处理, 本题的测试用例中似乎没有给出溢出的情况 ...
分类:其他好文   时间:2014-05-14 20:41:19    阅读次数:244
LeetCode 009 Palindrome Number
【题目】 Determine whether an integer is a palindrome. Do this without extra space. 【题意】 题意判断一个整数是否是回文数 注意一下几点: 1. 不能用额外的空间 2. 负数不是回文数...
分类:其他好文   时间:2014-05-14 20:31:10    阅读次数:298
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!