![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法第四版练习
恪心
Do all you can to survive, because life is never something you live only for yourself.
展开
-
字符串取反
public static String mystery(String s) { int N = s.length(); if (N <= 1) { return s; } String a = s.substring(0, N / 2); String b = s.substring(N / 2, N); return mystery(b) + mystery...原创 2019-12-11 19:34:42 · 839 阅读 · 0 评论 -
回环变位
public static void main(String[] args) { System.out.println("输入字符串1:"); String str1 = StdIn.readLine(); System.out.println("输入字符串2:"); String str2 = StdIn.readLine();...原创 2019-12-11 19:28:02 · 161 阅读 · 0 评论 -
矩阵常用操作的JAVA实现以及算法分析(向量点乘、矩阵乘矩阵、矩阵的转置、矩阵乘向量、向量乘矩阵)
public class Matrix { //向量点乘 public static double Dot(double[] a, double[] b){ /* * 点乘 * a = [a1,a2,...,an] b = [b1, b2, ..., bn] * a .* b = a1b1 + a2b2 + .....原创 2019-11-30 21:11:11 · 802 阅读 · 0 评论 -
《算法》第四版习题 1.1.31(对求点的详细注释)
package chapter1_1;import java.awt.Color;import edu.princeton.cs.algs4.StdDraw;import edu.princeton.cs.algs4.StdRandom;public class exc1_31 { static class Point { double x; do...原创 2019-11-28 21:04:32 · 198 阅读 · 0 评论 -
《算法》第四版练习题目录
我做的练习题是我自己先自己做,不会再参考其他前辈做的答案。我去网上找了一下,很少有带注释的答案。导致我答案甚至都看不懂。我自己做的带注释,包含我做题的思路,或者做题需要在网上查的资料,仅供参考。许多练习和前辈提供的答案相同,也不能说完全是自己做的,这是我参考的答案链接:https://blog.csdn.net/u013541140/article/details/53222770现在随缘将...原创 2019-12-06 21:24:06 · 207 阅读 · 0 评论 -
《算法》第四版练习 1.2.3
package chapter1_2;import edu.princeton.cs.algs4.*;public class exc2_3 { public static void main(String[] args) { System.out.println("输入2D间隔的数量:"); int N = StdIn.readInt(); ...原创 2019-12-06 21:03:53 · 142 阅读 · 0 评论