前言

本文的主体是机器学习中所用到的概率论知识,因此奉行Lazy evaluation,对这些知识更深层次的探究只在绝对必要时完成。本文假设你学过《概率论与数理统计》,仅指出花书的现有定义的不同,同时补充花书中特有的知识

阅读全文

前言

本文的主体是机器学习中所用到的线性代数知识,因此奉行Lazy evaluation,对这些知识更深层次的探究只在绝对必要时完成。

Concepts

Tensor

矩阵是向量的延申,而Tensor(张量)则是矩阵的延申。 向量可用一维数组表示,矩阵可用二维数组表示,而张量可用三维数组表示。 表示张量A的一个分量

阅读全文

没啥用的前言

说着再做UWP就剁手,我还是开了一个新坑🤣 这次是B岛的UWP端 论坛客户端的一个老大难问题是内容的呈现。论坛一般以网页端为主,网页做好,论坛活跃起来后之后才会开发客户端/有开发者愿意做第三方的客户端。因此,API绝大多数情况是为网页端为一等公民的。此外,各个UI框架展示内容的格式也各有不同。以上两个原因导致HTML被选做富文本展示的通用语言。

阅读全文

Deduplication on a Linked List

Given a singly linked list L with integer keys, you are supposed to remove the nodes with duplicated absolute values of the keys. That is, for each value K, only the first node of which the value or absolute value of its key equals K will be kept. At the mean time, all the removed nodes must be kept in a separate list. For example, given L being 21→-15→-15→-7→15, you must output 21→-15→-7, and the removed list -15→15.

阅读全文

Deepest Root

A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root is called the deepest root.

Input Specification

Each input file contains one test case. For each case, the first line contains a positive integer N (≤10​^4​​) which is the number of nodes, and hence the nodes are numbered from 1 to N. Then N−1 lines follow, each describes an edge by given the two adjacent nodes’ numbers.

阅读全文

PAT里链表题有各式各样的骚操作。这些非常规操作易学易用,但是习惯了这些后,反而对题目真正想考察的知识生疏了。今天就碰到一道这样的题,想用正经的算法写却写不出来。希望大家以我为戒,不要过多的学习这些「奇技淫巧」


Linked List Sorting这道题很常规,是个很一般的链表排序题。链表不能随机访问,因此算法上的选择限制很大,只有冒泡、插入、选择排序可以选。我选了冒泡练手,没想到没做出来。

阅读全文

Recover the Smallest Number

Given a collection of number segments, you are supposed to recover the smallest number from them. For example, given { 32, 321, 3214, 0229, 87 }, we can recover many numbers such like 32-321-3214-0229-87 or 0229-32-87-321-3214 with respect to different orders of combinations of these segments, and the smallest number is 0229-321-3214-32-87.

Input Specification

Each input file contains one test case. Each case gives a positive integer N (≤10​^4​​) followed by N number segments. Each segment contains a non-negative integer of no more than 8 digits. All the numbers in a line are separated by a space.

阅读全文

Maximum Subsequence Sum

Given a sequence of K integers { N​1​​, N​2​​, …, N​K​​ }. A continuous subsequence is defined to be { N​i​​, N​i+1​​, …, N​j​​ } where 1≤i≤j≤K. The Maximum Subsequence is the continuous subsequence which has the largest sum of its elements. For example, given sequence { -2, 11, -4, 13, -5, -2 }, its maximum subsequence is { 11, -4, 13 } with the largest sum being 20.

阅读全文

因为PAT刷题的缘故,开始再次接触C++.用过OOP语言再回来用C十分不习惯,C++就顺手多了.C没有泛型,字符串也不好用,C++就好多了,STL的容器和模板完美结合,字符串类也堪用.

阅读全文

Head of a gang

Head of a Gang

One way that the police finds the head of a gang is to check people’s phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be the total time length of all the phone calls made between the two persons. A “Gang” is a cluster of more than 2 persons who are related to each other with total relation weight being greater than a given threthold K. In each gang, the one with maximum total weight is the head. Now given a list of phone calls, you are supposed to find the gangs and the heads.

阅读全文