网站建设合同违约条款wordpress插件排列

diannao/2026/1/23 3:11:21/文章来源:
网站建设合同违约条款,wordpress插件排列,南充做网站的公司,wordpress 文件权限http://blog.jobbole.com/65218/ 本文由 伯乐在线 - 熊崽Kevin 翻译自 pypix.com。欢迎加入技术翻译小组。转载请参见文章末尾处的要求。 数据结构 数据结构的概念很好理解#xff0c;就是用来将数据组织在一起的结构。换句话说#xff0c;数据结构是用来存储一系列关联数据的…http://blog.jobbole.com/65218/ 本文由 伯乐在线 - 熊崽Kevin 翻译自 pypix.com。欢迎加入技术翻译小组。转载请参见文章末尾处的要求。 数据结构 数据结构的概念很好理解就是用来将数据组织在一起的结构。换句话说数据结构是用来存储一系列关联数据的东西。在Python中有四种内建的数据结构分别是List、Tuple、Dictionary以及Set。大部分的应用程序不需要其他类型的数据结构但若是真需要也有很多高级数据结构可供选择例如Collection、Array、Heapq、Bisect、Weakref、Copy以及Pprint。本文将介绍这些数据结构的用法看看它们是如何帮助我们的应用程序的。 关于四种内建数据结构的使用方法很简单并且网上有很多参考资料因此本文将不会讨论它们。 1. Collections collections模块包含了内建类型之外的一些有用的工具例如Counter、defaultdict、OrderedDict、deque以及nametuple。其中Counter、deque以及defaultdict是最常用的类。 1.1 Counter() 如果你想统计一个单词在给定的序列中一共出现了多少次诸如此类的操作就可以用到Counter。来看看如何统计一个list中出现的item次数 1 2 3 4 5 from collections import Counter li [Dog, Cat, Mouse, 42, Dog, 42, Cat, Dog] a Counter(li) print a # Counter({Dog: 3, 42: 2, Cat: 2, Mouse: 1}) 若要统计一个list中不同单词的数目可以这么用 1 2 3 4 5 6 7 from collections import Counter li [Dog, Cat, Mouse, 42, Dog, 42, Cat, Dog] a Counter(li) print a # Counter({Dog: 3, 42: 2, Cat: 2, Mouse: 1}) print len(set(li)) # 4 如果需要对结果进行分组可以这么做 1 2 3 4 5 6 7 8 9 10 from collections import Counter li [Dog, Cat, Mouse,Dog,Cat, Dog] a Counter(li) print a # Counter({Dog: 3, Cat: 2, Mouse: 1}) print {0} : {1}.format(a.values(),a.keys())  # [1, 3, 2] : [Mouse, Dog, Cat] print(a.most_common(3)) # [(Dog, 3), (Cat, 2), (Mouse, 1)] 以下的代码片段找出一个字符串中出现频率最高的单词并打印其出现次数。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 import re from collections import Counter string    Lorem ipsum dolor sit amet, consectetur     adipiscing elit. Nunc ut elit id mi ultricies     adipiscing. Nulla facilisi. Praesent pulvinar,     sapien vel feugiat vestibulum, nulla dui pretium orci,     non ultricies elit lacus quis ante. Lorem ipsum dolor     sit amet, consectetur adipiscing elit. Aliquam     pretium ullamcorper urna quis iaculis. Etiam ac massa     sed turpis tempor luctus. Curabitur sed nibh eu elit     mollis congue. Praesent ipsum diam, consectetur vitae     ornare a, aliquam a nunc. In id magna pellentesque     tellus posuere adipiscing. Sed non mi metus, at lacinia     augue. Sed magna nisi, ornare in mollis in, mollis     sed nunc. Etiam at justo in leo congue mollis.     Nullam in neque eget metus hendrerit scelerisque     eu non enim. Ut malesuada lacus eu nulla bibendum     id euismod urna sodales.  words re.findall(r\w, string) #This finds words in the document lower_words [word.lower() for word in words] #lower all the words word_counts Counter(lower_words) #counts the number each time a word appears print word_counts # Counter({elit: 5, sed: 5, in: 5, adipiscing: 4, mollis: 4, eu: 3, # id: 3, nunc: 3, consectetur: 3, non: 3, ipsum: 3, nulla: 3, pretium: # 2, lacus: 2, ornare: 2, at: 2, praesent: 2, quis: 2, sit: 2, congue: 2, amet: 2, # etiam: 2, urna: 2, a: 2, magna: 2, lorem: 2, aliquam: 2, ut: 2, ultricies: 2, mi: 2, # dolor: 2, metus: 2, ac: 1, bibendum: 1, posuere: 1, enim: 1, ante: 1, sodales: 1, tellus: 1, # vitae: 1, dui: 1, diam: 1, pellentesque: 1, massa: 1, vel: 1, nullam: 1, feugiat: 1, luctus: 1, # pulvinar: 1, iaculis: 1, hendrerit: 1, orci: 1, turpis: 1, nibh: 1, scelerisque: 1, ullamcorper: 1, # eget: 1, neque: 1, euismod: 1, curabitur: 1, leo: 1, sapien: 1, facilisi: 1, vestibulum: 1, nisi: 1, # justo: 1, augue: 1, tempor: 1, lacinia: 1, malesuada: 1}) 1.2 Deque Deque是一种由队列结构扩展而来的双端队列(double-ended queue)队列元素能够在队列两端添加或删除。因此它还被称为头尾连接列表(head-tail linked list)尽管叫这个名字的还有另一个特殊的数据结构实现。 Deque支持线程安全的经过优化的append和pop操作在队列两端的相关操作都能够达到近乎O(1)的时间复杂度。虽然list也支持类似的操作但是它是对定长列表的操作表现很不错而当遇到pop(0)和insert(0, v)这样既改变了列表的长度又改变其元素位置的操作时其复杂度就变为O(n)了。 来看看相关的比较结果 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 import time from collections import deque num 100000 def append(c):     for i in range(num):         c.append(i) def appendleft(c):     if isinstance(c, deque):         for i in range(num):             c.appendleft(i)     else:         for i in range(num):             c.insert(0, i) def pop(c):     for i in range(num):         c.pop() def popleft(c):     if isinstance(c, deque):         for i in range(num):             c.popleft()     else:         for i in range(num):             c.pop(0) for container in [deque, list]:     for operation in [append, appendleft, pop, popleft]:         c container(range(num))         start time.time()         operation(c)         elapsed time.time() - start         print Completed {0}/{1} in {2} seconds: {3} ops/sec.format(               container.__name__, operation.__name__, elapsed, num / elapsed) # Completed deque/append in 0.0250000953674 seconds: 3999984.74127 ops/sec # Completed deque/appendleft in 0.0199999809265 seconds: 5000004.76838 ops/sec # Completed deque/pop in 0.0209999084473 seconds: 4761925.52225 ops/sec # Completed deque/popleft in 0.0199999809265 seconds: 5000004.76838 ops/sec # Completed list/append in 0.0220000743866 seconds: 4545439.17637 ops/sec # Completed list/appendleft in 21.3209998608 seconds: 4690.21155917 ops/sec # Completed list/pop in 0.0240001678467 seconds: 4166637.52682 ops/sec # Completed list/popleft in 4.01799988747 seconds: 24888.0046791 ops/sec 另一个例子是执行基本的队列操作 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 from collections import deque q deque(range(5)) q.append(5) q.appendleft(6) print q print q.pop() print q.popleft() print q.rotate(3) print q print q.rotate(-1) print q # deque([6, 0, 1, 2, 3, 4, 5]) # 5 # 6 # None # deque([2, 3, 4, 0, 1]) # None # deque([3, 4, 0, 1, 2]) 译者注:rotate是队列的旋转操作Right rotate(正参数)是将右端的元素移动到左端而Left rotate(负参数)则相反。 1.3 Defaultdict 这个类型除了在处理不存在的键的操作之外与普通的字典完全相同。当查找一个不存在的键操作发生时它的default_factory会被调用提供一个默认的值并且将这对键值存储下来。其他的参数同普通的字典方法dict()一致一个defaultdict的实例同内建dict一样拥有同样地操作。 defaultdict对象在当你希望使用它存放追踪数据的时候很有用。举个例子假定你希望追踪一个单词在字符串中的位置那么你可以这么做 1 2 3 4 5 6 7 8 9 10 11 12 13 from collections import defaultdict s the quick brown fox jumps over the lazy dog words s.split() location defaultdict(list) for m, n in enumerate(words):     location[n].append(m) print location # defaultdict(type list, {brown: [2], lazy: [7], over: [5], fox: [3], # dog: [8], quick: [1], the: [0, 6], jumps: [4]}) 是选择lists或sets与defaultdict搭配取决于你的目的使用list能够保存你插入元素的顺序而使用set则不关心元素插入顺序它会帮助消除重复元素。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 from collections import defaultdict s the quick brown fox jumps over the lazy dog words s.split() location defaultdict(set) for m, n in enumerate(words):     location[n].add(m) print location # defaultdict(type set, {brown: set([2]), lazy: set([7]), # over: set([5]), fox: set([3]), dog: set([8]), quick: set([1]), # the: set([0, 6]), jumps: set([4])}) 另一种创建multidict的方法 1 2 3 4 5 6 7 8 9 s the quick brown fox jumps over the lazy dog d {} words s.split() for key, value in enumerate(words):     d.setdefault(key, []).append(value) print d # {0: [the], 1: [quick], 2: [brown], 3: [fox], 4: [jumps], 5: [over], 6: [the], 7: [lazy], 8: [dog]} 一个更复杂的例子 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 class Example(dict):     def __getitem__(self, item):         try:             return dict.__getitem__(self, item)         except KeyError:             value self[item] type(self)()             return value a Example() a[1][2][3] 4 a[1][3][3] 5 a[1][2][test] 6 print a # {1: {2: {test: 6, 3: 4}, 3: {3: 5}}} 2. Array array模块定义了一个很像list的新对象类型不同之处在于它限定了这个类型只能装一种类型的元素。array元素的类型是在创建并使用的时候确定的。 如果你的程序需要优化内存的使用并且你确定你希望在list中存储的数据都是同样类型的那么使用array模块很合适。举个例子如果需要存储一千万个整数如果用list那么你至少需要160MB的存储空间然而如果使用array你只需要40MB。但虽然说能够节省空间array上几乎没有什么基本操作能够比在list上更快。 在使用array进行计算的时候需要特别注意那些创建list的操作。例如使用列表推导式(list comprehension)的时候会将array整个转换为list使得存储空间膨胀。一个可行的替代方案是使用生成器表达式创建新的array。看代码 1 2 3 4 import array a array.array(i, [1,2,3,4,5]) b array.array(a.typecode, (2*x for x in a)) 因为使用array是为了节省空间所以更倾向于使用in-place操作。一种更高效的方法是使用enumerate 1 2 3 4 5 import array a array.array(i, [1,2,3,4,5]) for i, x in enumerate(a):     a[i] 2*x 对于较大的array这种in-place修改能够比用生成器创建一个新的array至少提升15%的速度。 那么什么时候使用array呢是当你在考虑计算的因素之外还需要得到一个像C语言里一样统一元素类型的数组时。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 import array from timeit import Timer def arraytest():     a array.array(i, [1, 2, 3, 4, 5])     b array.array(a.typecode, (2 * x for x in a)) def enumeratetest():     a array.array(i, [1, 2, 3, 4, 5])     for i, x in enumerate(a):         a[i] 2 * x if __name____main__:     m Timer(arraytest(), from __main__ import arraytest)     n Timer(enumeratetest(), from __main__ import enumeratetest)     print m.timeit() # 5.22479210582     print n.timeit() # 4.34367196717 3. Heapq heapq模块使用一个用堆实现的优先级队列。堆是一种简单的有序列表并且置入了堆的相关规则。 堆是一种树形的数据结构树上的子节点与父节点之间存在顺序关系。二叉堆(binary heap)能够用一个经过组织的列表或数组结构来标识在这种结构中元素N的子节点的序号为2*N1和2*N2(下标始于0)。简单来说这个模块中的所有函数都假设序列是有序的所以序列中的第一个元素(seq[0])是最小的序列的其他部分构成一个二叉树并且seq[i]节点的子节点分别为seq[2*i1]以及seq[2*i2]。当对序列进行修改时相关函数总是确保子节点大于等于父节点。 1 2 3 4 5 6 7 8 9 import heapq heap [] for value in [20, 10, 30, 50, 40]:     heapq.heappush(heap, value) while heap:     print heapq.heappop(heap) heapq模块有两个函数nlargest()和nsmallest()顾名思义让我们来看看它们的用法。 1 2 3 4 5 import heapq nums [1, 8, 2, 23, 7, -4, 18, 23, 42, 37, 2] print(heapq.nlargest(3, nums)) # Prints [42, 37, 23] print(heapq.nsmallest(3, nums)) # Prints [-4, 1, 2] 两个函数也能够通过一个键参数使用更为复杂的数据结构例如 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 import heapq portfolio [ {name: IBM, shares: 100, price: 91.1}, {name: AAPL, shares: 50, price: 543.22}, {name: FB, shares: 200, price: 21.09}, {name: HPQ, shares: 35, price: 31.75}, {name: YHOO, shares: 45, price: 16.35}, {name: ACME, shares: 75, price: 115.65} ] cheap heapq.nsmallest(3, portfolio, keylambda s: s[price]) expensive heapq.nlargest(3, portfolio, keylambda s: s[price]) print cheap # [{price: 16.35, name: YHOO, shares: 45}, # {price: 21.09, name: FB, shares: 200}, {price: 31.75, name: HPQ, shares: 35}] print expensive # [{price: 543.22, name: AAPL, shares: 50}, {price: 115.65, name: ACME, # shares: 75}, {price: 91.1, name: IBM, shares: 100}] 来看看如何实现一个根据给定优先级进行排序并且每次pop操作都返回优先级最高的元素的队列例子。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 import heapq class Item:     def __init__(self, name):         self.name name     def __repr__(self):         return Item({!r}).format(self.name) class PriorityQueue:     def __init__(self):         self._queue []         self._index 0     def push(self, item, priority):         heapq.heappush(self._queue, (-priority, self._index, item))         self._index 1     def pop(self):         return heapq.heappop(self._queue)[-1] q PriorityQueue() q.push(Item(foo), 1) q.push(Item(bar), 5) q.push(Item(spam), 4) q.push(Item(grok), 1) print q.pop() # Item(bar) print q.pop() # Item(spam) print q.pop() # Item(foo) print q.pop() # Item(grok) 4. Bisect bisect模块能够提供保持list元素序列的支持。它使用了二分法完成大部分的工作。它在向一个list插入元素的同时维持list是有序的。在某些情况下这比重复的对一个list进行排序更为高效并且对于一个较大的list来说对每步操作维持其有序也比对其排序要高效。 假设你有一个range集合 1 a [(0, 100), (150, 220), (500, 1000)] 如果我想添加一个range (250, 400)我可能会这么做 1 2 3 4 5 6 7 import bisect a [(0, 100), (150, 220), (500, 1000)] bisect.insort_right(a, (250,400)) print a # [(0, 100), (150, 220), (250, 400), (500, 1000)] 我们可以使用bisect()函数来寻找插入点 1 2 3 4 5 6 7 8 9 import bisect a [(0, 100), (150, 220), (500, 1000)] bisect.insort_right(a, (250,400)) bisect.insort_right(a, (399, 450)) print a # [(0, 100), (150, 220), (250, 400), (500, 1000)] print bisect.bisect(a, (550, 1200)) # 5 bisect(sequence, item) index 返回元素应该的插入点但序列并不被修改。 1 2 3 4 5 6 7 8 9 10 11 import bisect a [(0, 100), (150, 220), (500, 1000)] bisect.insort_right(a, (250,400)) bisect.insort_right(a, (399, 450)) print a # [(0, 100), (150, 220), (250, 400), (500, 1000)] print bisect.bisect(a, (550, 1200)) # 5 bisect.insort_right(a, (550, 1200)) print a # [(0, 100), (150, 220), (250, 400), (399, 450), (500, 1000), (550, 1200)] 新元素被插入到第5的位置。 5. Weakref weakref模块能够帮助我们创建Python引用却不会阻止对象的销毁操作。这一节包含了weak reference的基本用法并且引入一个代理类。 在开始之前我们需要明白什么是strong reference。strong reference是一个对对象的引用次数、生命周期以及销毁时机产生影响的指针。strong reference如你所见就是当你将一个对象赋值给一个变量的时候产生的 1 2 a [1,2,3] b a 在这种情况下这个列表有两个strong reference分别是a和b。在这两个引用都被释放之前这个list不会被销毁。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 class Foo(object):     def __init__(self):         self.obj None         print created     def __del__(self):         print destroyed     def show(self):         print self.obj     def store(self, obj):         self.obj obj a Foo() # created b a del a del b # destroyed Weak reference则是对对象的引用计数器不会产生影响。当一个对象存在weak reference时并不会影响对象的撤销。这就说如果一个对象仅剩下weak reference那么它将会被销毁。 你可以使用weakref.ref函数来创建对象的weak reference。这个函数调用需要将一个strong reference作为第一个参数传给函数并且返回一个weak reference。 1 2 3 4 5 import weakref a Foo() created b weakref.ref(a) b 一个临时的strong reference可以从weak reference中创建即是下例中的b() 1 2 3 4 a b() True b().show() None 请注意当我们删除strong reference的时候对象将立即被销毁。 1 2 del a destroyed 如果试图在对象被摧毁之后通过weak reference使用对象则会返回None 1 2 b() is None True 若是使用weakref.proxy就能提供相对于weakref.ref更透明的可选操作。同样是使用一个strong reference作为第一个参数并且返回一个weak referenceproxy更像是一个strong reference但当对象不存在时会抛出异常。 1 2 3 4 5 6 7 8 9 10 11 12 a Foo() created b weakref.proxy(a) b.store(fish) b.show() fish del a destroyed b.show() Traceback (most recent call last):   File , line 1, in ? ReferenceError: weakly-referenced object no longer exists 完整的例子 引用计数器是由Python的垃圾回收器使用的当一个对象的应用计数器变为0则其将会被垃圾回收器回收。 最好将weak reference用于开销较大的对象或避免循环引用(虽然垃圾回收器经常干这种事情)。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 import weakref import gc class MyObject(object):     def my_method(self):         print my_method was called! obj MyObject() r weakref.ref(obj) gc.collect() assert r() is obj #r() allows you to access the object referenced: its there. obj 1 #Lets change what obj references to gc.collect() assert r() is None #There is no object left: it was gced. 提示只有library模块中定义的class instances、functions、methods、sets、frozen sets、files、generators、type objects和certain object types(例如sockets、arrays和regular expression patterns)支持weakref。内建函数以及大部分内建类型如lists、dictionaries、strings和numbers则不支持。 6. Copy() 通过shallow或deep copy语法提供复制对象的函数操作。 shallow和deep copying的不同之处在于对于混合型对象的操作(混合对象是包含了其他类型对象的对象例如list或其他类实例)。 对于shallow copy而言它创建一个新的混合对象并且将原对象中其他对象的引用插入新对象。对于deep copy而言它创建一个新的对象并且递归地复制源对象中的其他对象并插入新的对象中。普通的赋值操作知识简单的将心变量指向源对象。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 import copy a [1,2,3] b [4,5] c [a,b] # Normal Assignment d c print id(c) id(d)          # True - d is the same object as c print id(c[0]) id(d[0])    # True - d[0] is the same object as c[0] # Shallow Copy d copy.copy(c) print id(c) id(d)          # False - d is now a new object print id(c[0]) id(d[0])    # True - d[0] is the same object as c[0] # Deep Copy d copy.deepcopy(c) print id(c) id(d)          # False - d is now a new object print id(c[0]) id(d[0])    # False - d[0] is now a new object shallow copy (copy())操作创建一个新的容器其包含的引用指向原对象中的对象。 deep copy (deepcopy())创建的对象包含的引用指向复制出来的新对象。 复杂的例子 假定我有两个类名为Manager和Graph每个Graph包含了一个指向其manager的引用而每个Manager有一个指向其管理的Graph的集合现在我们有两个任务需要完成 1) 复制一个graph实例使用deepcopy但其manager指向为原graph的manager。 2) 复制一个manager完全创建新manager但拷贝原有的所有graph。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import weakref, copy class Graph(object):     def __init__(self, managerNone):         self.manager None if manager is None else weakref.ref(manager)     def __deepcopy__(self, memodict):         manager self.manager()         return Graph(memodict.get(id(manager), manager)) class Manager(object):     def __init__(self, graphs[]):         self.graphs graphs         for g in self.graphs:             g.manager weakref.ref(self) a Manager([Graph(), Graph()]) b copy.deepcopy(a) if [g.manager() is b for g in b.graphs]:     print True # True if copy.deepcopy(a.graphs[0]).manager() is a:     print True # True 7. Pprint() Pprint模块能够提供比较优雅的数据结构打印方式如果你需要打印一个结构较为复杂层次较深的字典或是JSON对象时使用Pprint能够提供较好的打印结果。 假定你需要打印一个矩阵当使用普通的print时你只能打印出普通的列表不过如果使用pprint你就能打出漂亮的矩阵结构 如果 1 2 3 4 5 6 7 8 9 import pprint matrix [ [1,2,3], [4,5,6], [7,8,9] ] a pprint.PrettyPrinter(width20) a.pprint(matrix) # [[1, 2, 3], #  [4, 5, 6], #  [7, 8, 9]] 额外的知识 一些基本的数据结构 1. 单链链表 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 class Node:     def __init__(self):         self.data None         self.nextNode None     def set_and_return_Next(self):         self.nextNode Node()         return self.nextNode     def getNext(self):         return self.nextNode     def getData(self):         return self.data     def setData(self, d):         self.data d class LinkedList:     def buildList(self, array):         self.head Node()         self.head.setData(array[0])         self.temp self.head         for i in array[1:]:             self.temp self.temp.set_and_return_Next()             self.temp.setData(i)             self.tail self.temp         return self.head     def printList(self):         tempNode self.head         while(tempNode!self.tail):             print(tempNode.getData())             tempNode tempNode.getNext()         print(self.tail.getData()) myArray [3, 5, 4, 6, 2, 6, 7, 8, 9, 10, 21] myList LinkedList() myList.buildList(myArray) myList.printList()   2. 用Python实现的普林姆算法 译者注普林姆算法(Prims Algorithm)是图论中在加权连通图中搜索最小生成树的算法。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 from collections import defaultdict from heapq import heapify, heappop, heappush def prim( nodes, edges ):     conn defaultdict( list )     for n1,n2,c in edges:         conn[ n1 ].append( (c, n1, n2) )         conn[ n2 ].append( (c, n2, n1) )     mst []     used set( nodes[ 0 ] )     usable_edges conn[ nodes[0] ][:]     heapify( usable_edges )     while usable_edges:         cost, n1, n2 heappop( usable_edges )         if n2 not in used:             used.add( n2 )             mst.append( ( n1, n2, cost ) )             for e in conn[ n2 ]:                 if e[ 2 ] not in used:                     heappush( usable_edges, e )     return mst #test nodes list(ABCDEFG) edges [ (A, B, 7), (A, D, 5),           (B, C, 8), (B, D, 9), (B, E, 7),       (C, E, 5),       (D, E, 15), (D, F, 6),       (E, F, 8), (E, G, 9),       (F, G, 11)] print prim:, prim( nodes, edges ) 总结转载于:https://www.cnblogs.com/DjangoBlog/p/3677890.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/89083.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

茂名小学网站建设三合一网站建设是指

算法学习——华为机考题库3(HJ21 - HJ30) HJ21 简单密码 描述 现在有一种密码变换算法。 九键手机键盘上的数字与字母的对应: 1–1, abc–2, def–3, ghi–4, jkl–5, mno–6, pqrs–7, tuv–8 wxyz–9, 0–0,把密码…

公司建网站需要先注册域名龙岗 营销型网站建设

工具介绍 官网 http://www.linkdata.se/sourcecode/memwatch/ 其功能如下官网介绍,挑选重点整理: 1、 号称功能: 内存泄露检测 (检测未释放内存, 即 动态内存开辟未释放的情况) 2、 检测 多次调用free&…

门户网站布局个人主页图片

本篇会加入个人的所谓鱼式疯言 ❤️❤️❤️鱼式疯言:❤️❤️❤️此疯言非彼疯言 而是理解过并总结出来通俗易懂的大白话, 小编会尽可能的在每个概念后插入鱼式疯言,帮助大家理解的. 🤭🤭🤭可能说的不是那么严谨.但小编初心是能让更多人…

手把手网站开发网页编辑的软件工具包括

开启MongoDB服务时不添加任何参数时,默认是没有权限验证的,登录的用户可以对数据库任意操作而且可以远程访问数据库! 在刚安装完毕的时候MongoDB都默认有一个admin数据库,此时admin数据库是空的,没有记录权限相关的信息!当admin.system.users一个用户…

建站城律师做网络推广哪个网站好

微软刚刚在 Visual Studio Code 网站上宣布了“动态分享”(Live Share)功能,开发者们可以在 VS 2017 或 VS Code 中体验全新的实施协作。微软表示,Live Share 可让团队在相同的代码库上启用快速协作,而无需同步代码或配…

公司网站建设要求网站添加 百度商桥

因为本人的专业是财务方面的,而且目前也是在从事着财务管理的工作,在一家技术型的公司。平常与那些技术人员接触时,发现他们常常过多地关注于技术,而对与自己息息相关的财税知识却知之甚少。在不出现什么情况的时候,当…

科技网站建设 开题报告新产品开发流程管理

分页查询算是比较常用的一个查询了在DAO层主要是查两个数据第一个总条数第二个要查询起始记录数到查询的条数当第一次点击查询时候(非下一页时Page类里面预设的就是 index就是0 pageSize是预设值当点击下一页的时候 index 和 pageSize带的就是页面上面给的值了分页的页面一般的…

海南省做购房合同网站全国做网站的公司

文章目录 前言1. 本地安装PPTist2. PPTist 使用介绍3. 安装Cpolar内网穿透4. 配置公网地址5. 配置固定公网地址 前言 本文主要介绍如何在Windows系统环境本地部署开源在线演示文稿应用PPTist,并结合cpolar内网穿透工具实现随时随地远程访问与使用该项目。 PPTist …

网站建设尺寸wordpress 3d标签

一 HBase简介与环境部署 1.1 HBase简介&在Hadoop生态中的地位 1.1.1 什么是HBase HBase是一个分布式的、面向列的开源数据库HBase是Google BigTable的开源实现HBase不同于一般的关系数据库, 适合非结构化数据存储 1.1.2 BigTable BigTable是Google设计的分布式数据存储…

网站排名优化在线培训云营销网站建设电话咨询

一只小狐狸带你解锁 炼丹术&NLP 秘籍作者:机智的叉烧(OPPO算法工程师,擅长Query理解方向)背景搜索和推荐经常会被放在一起对比,其中最突出的区别就是搜索中存在query,需要充分考虑召回内容和query之间的…

怎么做网站网站怎样制作免费个人网页

文章目录 前言一、单选题二、填空题三、简答题总结前言 学习了项目的开发与发布之后,我们就可以单独对一个项目进行开发了,但是在企业中开发中,除了编码之外,还需要项目管理、团队协作开发等,这就是软件项目管理板块要学习的内容。本文是对《软件项目管理(第二版)》第 3…

网站建站的类型九江网站设计

【README】 消息中心的消息追踪需要使用 Trace 实现,Trace是 rabbitmq用于记录每一次发送的消息;方便开发者调试,排错。可通过插件形式提供可视化界面。 【1】 开启消息追踪 1)消息追踪通过 rabbitmq的插件 trace 来实现&#x…

襄阳网站建设电子商务论文

LiveGBS作为上级平台对接海康大华华为宇视等下级平台监控摄像机NVR硬件执法仪等GB28181设备 1、背景说明2、部署国标平台2.1、安装使用说明2.2、服务器网络环境2.3、信令服务配置 3、监控摄像头设备接入3.1、海康GB28181接入示例3.2、大华GB28181接入示例3.3、华为IPC GB28181接…

相亲网站上做it的骗术榆林网站建设推广

1、首先net stop mysql服务,并且切换到任务管理器,有与mysql有关的,最好关闭进程。 2、运行CMD命令切换到MySql安装bin目录,下面是我的mysql安装目录 cd C:\Program Files\MySQL\MySQL Server 5.6\bin 接着执行mysqld --skip-gra…

江苏建设信息官网网站景安免费虚拟主机

正则化方法有如下几种: 一、参数范数惩罚 其中L2、L1参数正则化介绍与关系如下 1、L2 参数正则化 直观解释如下: 2、L1 参数正则化 二、获取更多数据(扩样本) 避免过拟合的基本方法之一是从数据源获得更多数据,当训练数…

婴儿衣服做的网站好房地产建筑公司网站

7-38 图着色问题 (25 分)图着色问题是一个著名的NP完全问题。给定无向图G(V,E),问可否用K种颜色为V中的每一个顶点分配一种颜色,使得不会有两个相邻顶点具有同一种颜色?但本题并不是要你解决这个着色问题,而是对给定的一种颜色分配…

wordpress模板适合做什么站网站建设合作加盟

我在写项目的时候遇到了一个问题,就是在存商品id的时候我将它使用了JSON.stringify的格式转换了!!!于是便爆出了500这个错误!!! 我将JSON.stringify的格式去除之后,它就正常显示了&…

德阳网站建设ghxhwl手机编辑个人简历

目录 定义图形标记XML内容界面操作 定义 Sc 任务不是 BPMN 2.0 规范定义的官方任务,在 Flowable 中,Sc 任务是作为一种特殊的服务 任务来实现的,主要调用springcloud的微服务使用。 图形标记 由于 Sc 任务不是 BPMN 2.0 规范的“官方”任务…

怎么自己做网站推广门户网站推广方式

运行rustc hello_world.rs时出错。原因: 我的 gcc 是安装的指定版本 gcc-4.8,安装指定版本 gcc 可参考我的另一篇博文,这里找不到 cc 的原因是在移除原来软链的时候,cc 的软链也移除了。重新建立软链即可。 sudo ln -s gcc cc还有…

门户网站开发一般多少钱网站空间购买

目录 1.何谓水仙花数 2.求三位数的水仙花数 3.在遍历中使用Math.DivRem方法再求水仙花数 1.何谓水仙花数 水仙花数(Narcissistic number)是指一个 n 位正整数,它的每个位上的数字的 n 次幂之和等于它本身。例如,153 是一个 3 …