![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法与数据结构
qq_29842929
这个作者很懒,什么都没留下…
展开
-
java插入,希尔,快速,冒泡,选择排序
public class Sort{ public static void main(String[] args) { int[] array = new int[] { 34, 8, 64, 51, 32, 21 }; // InsertSort(array);//插入排序 // SheelSort(array);// 希尔排序 // QuickSort(array);//原创 2016-12-02 14:57:07 · 246 阅读 · 0 评论 -
回环变位
如果字符串s中的字符循环移动任意位置能够得到另一个字符串t,那么s就被成为t的回环变位。public class test{ public static void main(String[] args) { String s1 = "ACTGACG", s2 = "TGACGAC"; if (s1.length() == s2.length()) { if (s1.co原创 2016-12-07 10:22:36 · 444 阅读 · 0 评论 -
欧几里德 java
public class test{ public static void main(String[] args) { System.out.println(gcd(42823, 6409)); } public static int gcd(int m, int n) { if (m % n == 0) { return n; } else { return gc原创 2016-12-07 11:44:25 · 232 阅读 · 0 评论 -
归并排序 java
public class MyMergeSort { public static void main(String[] args) { int[] array = new int[] { 10, 11, 1, 5, 6, 99, 15, 160, 3, 5 }; new MyMergeSort().merge(array); for (int i : array) { Sys原创 2016-12-07 15:28:57 · 150 阅读 · 0 评论 -
java实现二分查找(迭代)
public class MyBinarySearch{ public static void main(String[] args) { int i = 100; int[] array = new int[i >> 1]; int n = 0; while ((i -= 2) > 0) { array[n++] = i; } // 查找4所在位置 Syst原创 2016-12-02 15:29:21 · 495 阅读 · 0 评论 -
java 实现Bag(单链表)
import java.util.Iterator;import java.util.NoSuchElementException;public class Bag implements Iterable { private static final int DEFAULT_CAPACITY = 10; private int size; private I[] theItems;原创 2016-12-09 16:53:24 · 4706 阅读 · 0 评论 -
树状数组与线段树
HDU 1166 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1166java 全部超时,不知道为什么 求大神讲解线段树import java.util.Scanner;public class test1166 { private static int[] score = new int[50原创 2017-02-21 09:38:44 · 289 阅读 · 0 评论 -
冒泡,选择,插入,希尔,归并,快排,基数排序
import java.util.LinkedList;import java.util.Queue;public class test { private static int[] array = new int[] { 100, 1, 99, 45, 6, 3, 10, 55, 44, 66, 111 }; public static void main(String[] arg原创 2017-03-16 12:16:17 · 367 阅读 · 0 评论