摘要: 一.冒泡排序(稳定) 算法原理 1.首先比较第一个和第二个数据,将其中较小的数据放到第一个位置,较大的放到第二个位置。然后比较第二个和第三个位置,仍将较大的放到后一个位置。以此类推,直到比较第n-1个数据和第n个数据。这样就将待排序序列中的最大的一个放到第n个位置上,这个过程称为一趟排序。 2.对前 阅读全文
posted @ 2015-06-17 15:18 Rosanne 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 内部排序:全部待排序记录都可以同时调入内存进行的排序。 外部排序:待排序记录的数量太大,以致无法将其同时调入内存,尚需访问外存的排序过程。 排序中的基本操作: 1. 比较关键字大小 (对大多数排序算法是必须的) 2. 移动记录 (可通过改变记录的存储方式避免) 待排序记录的存储方式: 1. 存储在地 阅读全文
posted @ 2015-06-17 14:54 Rosanne 阅读(1067) 评论(0) 推荐(0) 编辑
摘要: Description:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".Code: 1 string addBinary(string... 阅读全文
posted @ 2015-06-17 12:02 Rosanne 阅读(219) 评论(0) 推荐(0) 编辑
摘要: Description:在Vmware Workstation 11上安装了Ubuntu 10.0,画面显示如下所示:Ubuntu系统的屏幕太小。调整方法:调节显示器分辨率即可,下图是将分辨率调节为1920*1080的结果。 阅读全文
posted @ 2015-06-17 09:06 Rosanne 阅读(8246) 评论(0) 推荐(0) 编辑
摘要: Description:Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant... 阅读全文
posted @ 2015-06-16 23:44 Rosanne 阅读(218) 评论(0) 推荐(0) 编辑
摘要: Description:Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its ... 阅读全文
posted @ 2015-06-16 23:34 Rosanne 阅读(159) 评论(0) 推荐(0) 编辑
摘要: Description:Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and e... 阅读全文
posted @ 2015-06-16 23:30 Rosanne 阅读(189) 评论(0) 推荐(0) 编辑
摘要: Description:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were in... 阅读全文
posted @ 2015-06-15 15:36 Rosanne 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Description:Given a sorted array, remove the duplicates in place such that each element appear onlyonceand return the new length.Do not allocate extra... 阅读全文
posted @ 2015-06-15 15:31 Rosanne 阅读(150) 评论(0) 推荐(0) 编辑
摘要: Description:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->... 阅读全文
posted @ 2015-06-14 20:36 Rosanne 阅读(152) 评论(0) 推荐(0) 编辑