算法
记录本人学习过的数据结构,当做自已的笔记本
因渺小而伟大
努力不一定会带来改变,但可能是一个让你变得‘好一点’的机会,虽然有时看着那些比你聪明还比你优秀的人确实会觉得不公平,但笨一点没关系,慢一点也无所谓,反正每前进一点就甩掉了几个比你不行的人,前方有路,身后有人,能吃能睡,至少还活着,就都有可能。
展开
-
八大排序之插入排序
public class InsertSort { public static void main(String[] args) { // int[] arr = {1, 6, 4, 2, 3}; // 测试时间复杂度 int [] arr = new int[80000]; for (int i = 0; i < arr.l...原创 2020-04-08 22:59:27 · 73 阅读 · 0 评论 -
八大排序之归并排序
// TODO 归并排序 public class MergeSort { public static void main(String[] args) { // int[] arr = {8, 4, 5, 7, 1, 3, 6, 2}; // 测试时间复杂度 O(n log n) int [] arr = new int[80000]; ...原创 2020-04-08 22:54:17 · 91 阅读 · 0 评论 -
八大排序之冒泡排序
// TODO 冒泡排序的优化 public class BubbleSort { public static void main(String[] args) { // int[] arr={9,6,4,2,3}; // int[] arr={0,1,2,3,9}; // 测试时间复杂度 O(n^2) int [] arr ...原创 2020-04-08 22:51:43 · 93 阅读 · 0 评论 -
八大排序之桶排序
public class RadixSort { public static void main(String[] args) { // int[] arr = {542,53,3,14,214,748}; // 时间复杂度 O(n+k) 稳定性好的 一种排序算法 int [] arr = new int[80000]; int[...原创 2020-04-08 22:46:04 · 178 阅读 · 0 评论 -
八大排序之快速排序
// 快速排序 public class QuickSort { public static void main(String[] args) { int[] arr = {-9,78,0,23,-567,-70}; // int[] arr = {1,4,3,2}; // 测试时间复杂度 O(n^2) /* int...原创 2020-04-08 22:38:20 · 91 阅读 · 0 评论 -
逆波兰计算器
使用到 中缀以及后缀表达式来完成这个计算器 如果 不知道中缀 和 后缀是怎么计算结果的点击下面这两个链接进行查看 单独使用中缀表达式 完成计算器文章 使用后缀表达式完成计算 能够计算小数以及处理带括号的表达式优先级的问题 // 中缀表达式 转后缀表达式 public class InfixExpression { // 判断符号 public static Boolean isO...原创 2020-04-03 03:57:58 · 149 阅读 · 0 评论 -
中缀表达式
中缀表达式就是是我们常用的加减乘除的方式 这种表达式的缺点:就是无法解决当带有括号时的计算表达式 // 简单的实现一个栈 没有使用到JDK自带的栈 public class ArrayStack { public int arr[]; public int top; private int size; public ArrayStack() { } ...原创 2020-04-03 03:42:21 · 2025 阅读 · 0 评论 -
逆波兰表达式
// 逆波兰表达式 计算 public class PostfixExpression { //将一个逆波兰表达式,依次将数据和运算符放入到Arraylist中 public static List<String> getListString(String suffisExpression) { String[] split = suffisExpre...原创 2020-04-03 03:16:39 · 112 阅读 · 0 评论