p72专题

Python番外(3)——P72性能分析

首先将下列代码保存到cprof_example.py文件: import numpy as npfrom numpy.linalg import eigvals'''函数'''def run_experiment(niter = 100):K = 100results = []for _ in xrange(niter):mat = np.random.randn(K,K)max_eigen

The XOR Largest Pair(算法竞赛进阶指南 P72,Trie)

一.题目链接: The XOR Largest Pair 二.题目大意: 有 n 个数,求任意两个数异或得到的最大值. 三.分析: 刚学习了字典树,觉得还不错. 把每个数分解为二进制存到字典树中,查询即可. 四.代码实现: #include <set>#include <map>#include <ctime>#include <queue>#include <cmath>