
算法与数据结构
ph3636
这个作者很懒,什么都没留下…
展开
-
算法与数据结构
1。https://leetcode.com/problems/reverse-words-in-a-string/#/description, Given an input string, reverse the string word by word. For example, Given s = "the sky is blue", return "blue is sky the". ...原创 2017-09-26 16:11:38 · 252 阅读 · 0 评论 -
快速排序
排序进行的前提条件是传入的左侧下标小于右侧,否则排序已经完成,首先需要选择一个标志数,根据这个数把数组分成两个数组,然后分别对这两个数组进行排序。 public class QuickSort { public static void main(String[] args) { int arr[] = {1, 3, 2, 9, 6, 8, 4, 7, 5, 0...原创 2019-08-25 09:56:07 · 322 阅读 · 0 评论 -
二分查找
二分查找必须要根据一个有序数组进行查找,数组的排序规则可以是正序或者倒序 public class BinarySearch { public static void main(String[] args) { int arr[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} ; int index = binarySearch(...原创 2019-08-25 09:57:04 · 202 阅读 · 0 评论