05 2016 档案

摘要:冒泡排序(C++) 冒泡排序(C++): 原理是临近的数字两两进行比较,按照从小到大或者从大到小的顺序进行交换, 这样一趟过去后,最大或最小的数字被交换到了最后一位, 然后再从头开始进行两两比较交换,直到倒数第二位时结束,其余类似看例子 例子: 3,4,0,8,0,1 3,4,0,8,0,1:3>4 阅读全文
posted @ 2016-05-22 15:26 19Q3 阅读(526) 评论(0) 推荐(0)
摘要:选择排序(C++) 选择排序: 选择排序(Selection sort)是一种简单直观的排序算法。它的工作原理是每一次从待排序的数据元素中选出最小(或最大)的一个元素,存放在序列的起始位置,直到全部待排序的数据元素排完。 选择排序是不稳定的排序方法(比如序列[5, 5, 3]第一次就将第一个[5]与 阅读全文
posted @ 2016-05-16 16:32 19Q3 阅读(215) 评论(0) 推荐(0)
摘要:345. Reverse Vowels of a String Write a function that takes a string as input and reverse only the vowels of a string. Example 1: Given s = "hello", r 阅读全文
posted @ 2016-05-14 17:53 19Q3 阅读(123) 评论(0) 推荐(0)
摘要:169. Majority Element Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. Y 阅读全文
posted @ 2016-05-14 17:49 19Q3 阅读(214) 评论(0) 推荐(0)
摘要:217. Contains Duplicate Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears a 阅读全文
posted @ 2016-05-14 17:45 19Q3 阅读(195) 评论(0) 推荐(0)
摘要:171. Excel Sheet Column Number Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding 阅读全文
posted @ 2016-05-14 17:39 19Q3 阅读(141) 评论(0) 推荐(0)
摘要:242. Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For example, s = "anagram", t = "nagaram", return 阅读全文
posted @ 2016-05-14 17:37 19Q3 阅读(215) 评论(0) 推荐(0)
摘要:100. Same Tree Given two binary trees, write a function to check if they are equal or not. Two binary trees are considered equal if they are structura 阅读全文
posted @ 2016-05-14 17:33 19Q3 阅读(158) 评论(0) 推荐(0)
摘要:237. Delete Node in a Linked Lis t Write a function to delete a node (except the tail) in a singly linked list, given only access to that node. Suppos 阅读全文
posted @ 2016-05-14 17:27 19Q3 阅读(206) 评论(0) 推荐(0)
摘要:283. Move Zeroes Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. 阅读全文
posted @ 2016-05-14 17:21 19Q3 阅读(162) 评论(0) 推荐(0)
摘要:226. Invert Binary Tree Invert a binary tree. to 阅读全文
posted @ 2016-05-14 17:13 19Q3 阅读(183) 评论(0) 推荐(0)
摘要:104. Maximum Depth of Binary Tree Given a binary tree, find its maximum depth. The maximum depth is the number of nodes along the longest path from th 阅读全文
posted @ 2016-05-14 17:10 19Q3 阅读(150) 评论(0) 推荐(0)
摘要:258. Add Digits Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the 阅读全文
posted @ 2016-05-14 17:05 19Q3 阅读(231) 评论(0) 推荐(0)
摘要:292. Nim Game(C++) You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to 阅读全文
posted @ 2016-05-14 16:54 19Q3 阅读(274) 评论(0) 推荐(0)
摘要:344. Reverse String Write a function that takes a string as input and returns the string reversed. Example: Given s = "hello", return "olleh". 题目大意: 字 阅读全文
posted @ 2016-05-14 16:46 19Q3 阅读(285) 评论(0) 推荐(0)
摘要:263. Ugly Number Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 阅读全文
posted @ 2016-05-14 16:28 19Q3 阅读(258) 评论(0) 推荐(0)
摘要:谢尔排序/缩减增量排序(C++) 谢尔排序/缩减增量排序: 他通过比较相距一定间隔的元素来工作,各趟比较所用的距离随着算法的进行而减小,直到只比较相邻元素的最后一趟排序为止。(好复杂) 看了一下实现代码,你就会发现它与插入排序好像,只不过在外面套了件马甲。 通过下面的代码可以发现在插入排序的基础上套 阅读全文
posted @ 2016-05-09 19:05 19Q3 阅读(282) 评论(0) 推荐(0)
摘要:插入排序(C++) 插入排序: 写这篇博文是为了增加对数据结构和算法的理解,同事增加编程的基本功。 当要对如下数据进行排序: 2,8,5,4,6,7,1 2,8,5,4,6,7,1 采用插入排序是的步骤: 2,8,5,4,6,7,1 取元素8和2对比,8比2大,不用移动 2,8,5,4,6,7,1 阅读全文
posted @ 2016-05-08 19:14 19Q3 阅读(513) 评论(0) 推荐(0)
摘要:Unity5.x使用重力 阅读全文
posted @ 2016-05-07 15:08 19Q3 阅读(1053) 评论(0) 推荐(1)