这是一道经典的NP问题,采用回朔法
i从1开始,
先加入1,再加入2 temp=[1,2]
然后去掉2 加3 temp=[1,3]
然后去掉3 加4 temp=[1,4]
然后去掉4 i=5不合法了 结束for循环
然后去掉1
返回到i=1,然后i++...
分类:
其他好文 时间:
2014-11-04 11:14:38
阅读次数:
187
1绪论1.1课题背景与研究意义1.2课题的应用领域1.3课题的现状1.4解决NP问题的几种算法及其比较2目前流行的几种排课算法的介绍2.1.自动排课算法2.2基于优先级的排课算法3基于时间片优先级排课算法描述与分析3.1排课中的基本原则3.2排课的基本要求3.3基于时间片优先级排课算法描述3.4算法...
分类:
编程语言 时间:
2014-11-03 23:53:06
阅读次数:
540
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
class AnimatedScatter(object):
"""An animated scatter plot using matplotlib.animations.FuncAnimation."""
...
分类:
其他好文 时间:
2014-10-30 22:43:16
阅读次数:
905
Problem DescriptionProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In...
分类:
其他好文 时间:
2014-10-27 17:34:09
阅读次数:
198
def get_CDF(numList): print "total number of numList %d"%len(numList) numArray = np.asarray(numList) dx = .01 bins_array = np.arange(-0.5,1.5,dx) his....
分类:
编程语言 时间:
2014-10-23 15:47:03
阅读次数:
341
初始化a = range(16)a = np.array(a)a = a.reshape(4,4)a[[ 0 1 2 3][ 4 5 6 7][ 8 9 10 11][12 13 14 15]]获取a的【0,1,4】行b = a[ range(2)+range(3,4),:][[ 0 1 2 3][...
分类:
编程语言 时间:
2014-10-21 17:31:17
阅读次数:
250
http://blog.csdn.net/linhuanmars/article/details/20828631这个题是一个NP问题,方法仍然是N-Queens中介绍的套路。基本思路是先排好序,然后每次递归中把剩下的元素一一加到结果集合中,并且把目标减去加入的元素,然后把剩下元素(包括当前加入的元...
分类:
其他好文 时间:
2014-10-18 00:35:49
阅读次数:
221
1.numpy.floor(a)返回大于元素的最小整数a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0])np.floor(a)array([-2., -2., -1., 0., 1., 1., 2.])2.np.linspace(0,20...
分类:
编程语言 时间:
2014-10-17 15:20:10
阅读次数:
211
原题:双向链表中,需要三个基本数据,一个携带具体数据,一个携带指向上一环节的prev指针,一个携带指向下一环节的next指针。请改写双向链表,仅用一个指针np实现双向链表的功能。定义np为next XOR prev,请根据表头提供的信息,为双向链表编写插入函数、删除函数和查找函数,并在O(1)时间内...
分类:
编程语言 时间:
2014-10-15 18:19:21
阅读次数:
151