ofs | hex dump | ascii |
---|
0000 | b3 f2 0d 0a a2 6c 87 4a 63 00 00 00 00 00 00 00 00 11 00 00 00 40 00 00 00 73 b2 01 00 00 64 00 | .....l.Jc............@...s....d. |
0020 | 00 5a 00 00 64 01 00 5a 01 00 64 02 00 64 03 00 64 04 00 64 05 00 64 06 00 64 07 00 67 06 00 5a | .Z..d..Z..d..d..d..d..d..d..g..Z |
0040 | 02 00 64 08 00 64 09 00 6b 03 00 6c 04 00 5a 04 00 6c 05 00 5a 05 00 6c 06 00 5a 06 00 6c 07 00 | ..d..d..k..l..Z..l..Z..l..Z..l.. |
0060 | 5a 07 00 6c 08 00 5a 08 00 6c 09 00 5a 09 00 01 64 08 00 64 0a 00 6b 0a 00 6c 0b 00 5a 0b 00 6c | Z..l..Z..l..Z...d..d..k..l..Z..l |
0080 | 0c 00 5a 0c 00 01 64 08 00 64 0b 00 6b 0d 00 5a 0d 00 64 0c 00 84 00 00 5a 0e 00 64 0d 00 84 00 | ..Z...d..d..k..Z..d.....Z..d.... |
00a0 | 00 5a 0f 00 64 0e 00 84 00 00 5a 10 00 64 0f 00 84 00 00 5a 11 00 64 10 00 84 00 00 5a 12 00 64 | .Z..d.....Z..d.....Z..d.....Z..d |
00c0 | 11 00 84 00 00 5a 13 00 64 12 00 84 00 00 5a 14 00 64 13 00 84 00 00 5a 15 00 79 32 00 64 08 00 | .....Z..d.....Z..d.....Z..y2.d.. |
00e0 | 64 14 00 6b 16 00 6c 0e 00 5a 0e 00 6c 0f 00 5a 0f 00 6c 11 00 5a 11 00 6c 10 00 5a 10 00 6c 12 | d..k..l..Z..l..Z..l..Z..l..Z..l. |
0100 | 00 5a 12 00 6c 13 00 5a 13 00 01 57 6e 13 00 04 65 17 00 6a 0a 00 6f 07 00 01 01 01 01 6e 02 00 | .Z..l..Z...Wn...e..j..o......n.. |
0120 | 01 58 65 13 00 5a 18 00 64 0b 00 64 15 00 84 01 00 5a 13 00 65 12 00 5a 1a 00 64 0b 00 64 16 00 | .Xe..Z..d..d.....Z..e..Z..d..d.. |
0140 | 84 01 00 5a 12 00 65 1b 00 64 17 00 6a 02 00 6f 79 00 01 67 00 00 5a 1c 00 64 18 00 64 19 00 64 | ...Z..e..d..j..oy..g..Z..d..d..d |
0160 | 1a 00 64 1b 00 64 1c 00 64 1d 00 64 1e 00 64 1f 00 64 20 00 64 21 00 67 0a 00 5a 1d 00 78 1b 00 | ..d..d..d..d..d..d..d!.g..Z..x.. |
0180 | 65 1d 00 44 5d 13 00 5a 1e 00 65 0e 00 65 1c 00 65 1e 00 83 02 00 01 71 66 01 57 67 00 00 5a 1f | e..D]..Z..e..e..e......qf.Wg..Z. |
01a0 | 00 78 1f 00 65 1c 00 6f 17 00 01 65 1f 00 69 20 00 65 0f 00 65 1c 00 83 01 00 83 01 00 01 71 86 | .x..e..o...e..i..e..e.........q. |
01c0 | 01 01 57 65 1f 00 47 48 6e 01 00 01 64 0b 00 53 28 22 00 00 00 73 ef 04 00 00 48 65 61 70 20 71 | ..We..GHn...d..S("...s....Heap.q |
01e0 | 75 65 75 65 20 61 6c 67 6f 72 69 74 68 6d 20 28 61 2e 6b 2e 61 2e 20 70 72 69 6f 72 69 74 79 20 | ueue.algorithm.(a.k.a..priority. |
0200 | 71 75 65 75 65 29 2e 0a 0a 48 65 61 70 73 20 61 72 65 20 61 72 72 61 79 73 20 66 6f 72 20 77 68 | queue)...Heaps.are.arrays.for.wh |
0220 | 69 63 68 20 61 5b 6b 5d 20 3c 3d 20 61 5b 32 2a 6b 2b 31 5d 20 61 6e 64 20 61 5b 6b 5d 20 3c 3d | ich.a[k].<=.a[2*k+1].and.a[k].<= |
0240 | 20 61 5b 32 2a 6b 2b 32 5d 20 66 6f 72 0a 61 6c 6c 20 6b 2c 20 63 6f 75 6e 74 69 6e 67 20 65 6c | .a[2*k+2].for.all.k,.counting.el |
0260 | 65 6d 65 6e 74 73 20 66 72 6f 6d 20 30 2e 20 20 46 6f 72 20 74 68 65 20 73 61 6b 65 20 6f 66 20 | ements.from.0...For.the.sake.of. |
0280 | 63 6f 6d 70 61 72 69 73 6f 6e 2c 0a 6e 6f 6e 2d 65 78 69 73 74 69 6e 67 20 65 6c 65 6d 65 6e 74 | comparison,.non-existing.element |
02a0 | 73 20 61 72 65 20 63 6f 6e 73 69 64 65 72 65 64 20 74 6f 20 62 65 20 69 6e 66 69 6e 69 74 65 2e | s.are.considered.to.be.infinite. |
02c0 | 20 20 54 68 65 20 69 6e 74 65 72 65 73 74 69 6e 67 0a 70 72 6f 70 65 72 74 79 20 6f 66 20 61 20 | ..The.interesting.property.of.a. |
02e0 | 68 65 61 70 20 69 73 20 74 68 61 74 20 61 5b 30 5d 20 69 73 20 61 6c 77 61 79 73 20 69 74 73 20 | heap.is.that.a[0].is.always.its. |
0300 | 73 6d 61 6c 6c 65 73 74 20 65 6c 65 6d 65 6e 74 2e 0a 0a 55 73 61 67 65 3a 0a 0a 68 65 61 70 20 | smallest.element...Usage:..heap. |
0320 | 3d 20 5b 5d 20 20 20 20 20 20 20 20 20 20 20 20 23 20 63 72 65 61 74 65 73 20 61 6e 20 65 6d 70 | =.[]............#.creates.an.emp |
0340 | 74 79 20 68 65 61 70 0a 68 65 61 70 70 75 73 68 28 68 65 61 70 2c 20 69 74 65 6d 29 20 23 20 70 | ty.heap.heappush(heap,.item).#.p |
0360 | 75 73 68 65 73 20 61 20 6e 65 77 20 69 74 65 6d 20 6f 6e 20 74 68 65 20 68 65 61 70 0a 69 74 65 | ushes.a.new.item.on.the.heap.ite |
0380 | 6d 20 3d 20 68 65 61 70 70 6f 70 28 68 65 61 70 29 20 23 20 70 6f 70 73 20 74 68 65 20 73 6d 61 | m.=.heappop(heap).#.pops.the.sma |
03a0 | 6c 6c 65 73 74 20 69 74 65 6d 20 66 72 6f 6d 20 74 68 65 20 68 65 61 70 0a 69 74 65 6d 20 3d 20 | llest.item.from.the.heap.item.=. |
03c0 | 68 65 61 70 5b 30 5d 20 20 20 20 20 20 20 23 20 73 6d 61 6c 6c 65 73 74 20 69 74 65 6d 20 6f 6e | heap[0].......#.smallest.item.on |
03e0 | 20 74 68 65 20 68 65 61 70 20 77 69 74 68 6f 75 74 20 70 6f 70 70 69 6e 67 20 69 74 0a 68 65 61 | .the.heap.without.popping.it.hea |
0400 | 70 69 66 79 28 78 29 20 20 20 20 20 20 20 20 20 20 20 23 20 74 72 61 6e 73 66 6f 72 6d 73 20 6c | pify(x)...........#.transforms.l |
0420 | 69 73 74 20 69 6e 74 6f 20 61 20 68 65 61 70 2c 20 69 6e 2d 70 6c 61 63 65 2c 20 69 6e 20 6c 69 | ist.into.a.heap,.in-place,.in.li |
0440 | 6e 65 61 72 20 74 69 6d 65 0a 69 74 65 6d 20 3d 20 68 65 61 70 72 65 70 6c 61 63 65 28 68 65 61 | near.time.item.=.heapreplace(hea |
0460 | 70 2c 20 69 74 65 6d 29 20 23 20 70 6f 70 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 73 6d 61 6c | p,.item).#.pops.and.returns.smal |
0480 | 6c 65 73 74 20 69 74 65 6d 2c 20 61 6e 64 20 61 64 64 73 0a 20 20 20 20 20 20 20 20 20 20 20 20 | lest.item,.and.adds............. |
04a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 23 20 6e 65 77 20 69 74 65 6d 3b 20 74 | ...................#.new.item;.t |
04c0 | 68 65 20 68 65 61 70 20 73 69 7a 65 20 69 73 20 75 6e 63 68 61 6e 67 65 64 0a 0a 4f 75 72 20 41 | he.heap.size.is.unchanged..Our.A |
04e0 | 50 49 20 64 69 66 66 65 72 73 20 66 72 6f 6d 20 74 65 78 74 62 6f 6f 6b 20 68 65 61 70 20 61 6c | PI.differs.from.textbook.heap.al |
0500 | 67 6f 72 69 74 68 6d 73 20 61 73 20 66 6f 6c 6c 6f 77 73 3a 0a 0a 2d 20 57 65 20 75 73 65 20 30 | gorithms.as.follows:..-.We.use.0 |
0520 | 2d 62 61 73 65 64 20 69 6e 64 65 78 69 6e 67 2e 20 20 54 68 69 73 20 6d 61 6b 65 73 20 74 68 65 | -based.indexing...This.makes.the |
0540 | 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 20 62 65 74 77 65 65 6e 20 74 68 65 0a 20 20 69 6e 64 65 | .relationship.between.the...inde |
0560 | 78 20 66 6f 72 20 61 20 6e 6f 64 65 20 61 6e 64 20 74 68 65 20 69 6e 64 65 78 65 73 20 66 6f 72 | x.for.a.node.and.the.indexes.for |
0580 | 20 69 74 73 20 63 68 69 6c 64 72 65 6e 20 73 6c 69 67 68 74 6c 79 20 6c 65 73 73 0a 20 20 6f 62 | .its.children.slightly.less...ob |
05a0 | 76 69 6f 75 73 2c 20 62 75 74 20 69 73 20 6d 6f 72 65 20 73 75 69 74 61 62 6c 65 20 73 69 6e 63 | vious,.but.is.more.suitable.sinc |
05c0 | 65 20 50 79 74 68 6f 6e 20 75 73 65 73 20 30 2d 62 61 73 65 64 20 69 6e 64 65 78 69 6e 67 2e 0a | e.Python.uses.0-based.indexing.. |
05e0 | 0a 2d 20 4f 75 72 20 68 65 61 70 70 6f 70 28 29 20 6d 65 74 68 6f 64 20 72 65 74 75 72 6e 73 20 | .-.Our.heappop().method.returns. |
0600 | 74 68 65 20 73 6d 61 6c 6c 65 73 74 20 69 74 65 6d 2c 20 6e 6f 74 20 74 68 65 20 6c 61 72 67 65 | the.smallest.item,.not.the.large |
0620 | 73 74 2e 0a 0a 54 68 65 73 65 20 74 77 6f 20 6d 61 6b 65 20 69 74 20 70 6f 73 73 69 62 6c 65 20 | st...These.two.make.it.possible. |
0640 | 74 6f 20 76 69 65 77 20 74 68 65 20 68 65 61 70 20 61 73 20 61 20 72 65 67 75 6c 61 72 20 50 79 | to.view.the.heap.as.a.regular.Py |
0660 | 74 68 6f 6e 20 6c 69 73 74 0a 77 69 74 68 6f 75 74 20 73 75 72 70 72 69 73 65 73 3a 20 68 65 61 | thon.list.without.surprises:.hea |
0680 | 70 5b 30 5d 20 69 73 20 74 68 65 20 73 6d 61 6c 6c 65 73 74 20 69 74 65 6d 2c 20 61 6e 64 20 68 | p[0].is.the.smallest.item,.and.h |
06a0 | 65 61 70 2e 73 6f 72 74 28 29 0a 6d 61 69 6e 74 61 69 6e 73 20 74 68 65 20 68 65 61 70 20 69 6e | eap.sort().maintains.the.heap.in |
06c0 | 76 61 72 69 61 6e 74 21 0a 73 6f 12 00 00 48 65 61 70 20 71 75 65 75 65 73 0a 0a 5b 65 78 70 6c | variant!.so...Heap.queues..[expl |
06e0 | 61 6e 61 74 69 6f 6e 20 62 79 20 46 72 61 6e e7 6f 69 73 20 50 69 6e 61 72 64 5d 0a 0a 48 65 61 | anation.by.Fran.ois.Pinard]..Hea |
0700 | 70 73 20 61 72 65 20 61 72 72 61 79 73 20 66 6f 72 20 77 68 69 63 68 20 61 5b 6b 5d 20 3c 3d 20 | ps.are.arrays.for.which.a[k].<=. |
0720 | 61 5b 32 2a 6b 2b 31 5d 20 61 6e 64 20 61 5b 6b 5d 20 3c 3d 20 61 5b 32 2a 6b 2b 32 5d 20 66 6f | a[2*k+1].and.a[k].<=.a[2*k+2].fo |
0740 | 72 0a 61 6c 6c 20 6b 2c 20 63 6f 75 6e 74 69 6e 67 20 65 6c 65 6d 65 6e 74 73 20 66 72 6f 6d 20 | r.all.k,.counting.elements.from. |
0760 | 30 2e 20 20 46 6f 72 20 74 68 65 20 73 61 6b 65 20 6f 66 20 63 6f 6d 70 61 72 69 73 6f 6e 2c 0a | 0...For.the.sake.of.comparison,. |
0780 | 6e 6f 6e 2d 65 78 69 73 74 69 6e 67 20 65 6c 65 6d 65 6e 74 73 20 61 72 65 20 63 6f 6e 73 69 64 | non-existing.elements.are.consid |
07a0 | 65 72 65 64 20 74 6f 20 62 65 20 69 6e 66 69 6e 69 74 65 2e 20 20 54 68 65 20 69 6e 74 65 72 65 | ered.to.be.infinite...The.intere |
07c0 | 73 74 69 6e 67 0a 70 72 6f 70 65 72 74 79 20 6f 66 20 61 20 68 65 61 70 20 69 73 20 74 68 61 74 | sting.property.of.a.heap.is.that |
07e0 | 20 61 5b 30 5d 20 69 73 20 61 6c 77 61 79 73 20 69 74 73 20 73 6d 61 6c 6c 65 73 74 20 65 6c 65 | .a[0].is.always.its.smallest.ele |
0800 | 6d 65 6e 74 2e 0a 0a 54 68 65 20 73 74 72 61 6e 67 65 20 69 6e 76 61 72 69 61 6e 74 20 61 62 6f | ment...The.strange.invariant.abo |
0820 | 76 65 20 69 73 20 6d 65 61 6e 74 20 74 6f 20 62 65 20 61 6e 20 65 66 66 69 63 69 65 6e 74 20 6d | ve.is.meant.to.be.an.efficient.m |
0840 | 65 6d 6f 72 79 0a 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 20 66 6f 72 20 61 20 74 6f 75 72 6e | emory.representation.for.a.tourn |
0860 | 61 6d 65 6e 74 2e 20 20 54 68 65 20 6e 75 6d 62 65 72 73 20 62 65 6c 6f 77 20 61 72 65 20 60 6b | ament...The.numbers.below.are.`k |
0880 | 27 2c 20 6e 6f 74 20 61 5b 6b 5d 3a 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ',.not.a[k]:.................... |
08a0 | 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 30 0a 0a 20 20 20 20 20 20 20 20 20 20 20 20 | .................0.............. |
08c0 | 20 20 20 20 20 20 31 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | ......1......................... |
08e0 | 20 20 20 20 20 20 20 20 32 0a 0a 20 20 20 20 20 20 20 20 20 20 33 20 20 20 20 20 20 20 20 20 20 | ........2............3.......... |
0900 | 20 20 20 20 20 34 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 35 20 20 20 20 20 20 20 20 20 | .....4................5......... |
0920 | 20 20 20 20 20 20 36 0a 0a 20 20 20 20 20 20 37 20 20 20 20 20 20 20 38 20 20 20 20 20 20 20 39 | ......6........7.......8.......9 |
0940 | 20 20 20 20 20 20 20 31 30 20 20 20 20 20 20 31 31 20 20 20 20 20 20 31 32 20 20 20 20 20 20 31 | .......10......11......12......1 |
0960 | 33 20 20 20 20 20 20 31 34 0a 0a 20 20 20 20 31 35 20 31 36 20 20 20 31 37 20 31 38 20 20 20 31 | 3......14......15.16...17.18...1 |
0980 | 39 20 32 30 20 20 20 32 31 20 32 32 20 20 20 32 33 20 32 34 20 20 20 32 35 20 32 36 20 20 20 32 | 9.20...21.22...23.24...25.26...2 |
09a0 | 37 20 32 38 20 20 20 32 39 20 33 30 0a 0a 0a 49 6e 20 74 68 65 20 74 72 65 65 20 61 62 6f 76 65 | 7.28...29.30...In.the.tree.above |
09c0 | 2c 20 65 61 63 68 20 63 65 6c 6c 20 60 6b 27 20 69 73 20 74 6f 70 70 69 6e 67 20 60 32 2a 6b 2b | ,.each.cell.`k'.is.topping.`2*k+ |
09e0 | 31 27 20 61 6e 64 20 60 32 2a 6b 2b 32 27 2e 20 20 49 6e 0a 61 6e 20 75 73 75 61 6c 20 62 69 6e | 1'.and.`2*k+2'...In.an.usual.bin |
0a00 | 61 72 79 20 74 6f 75 72 6e 61 6d 65 6e 74 20 77 65 20 73 65 65 20 69 6e 20 73 70 6f 72 74 73 2c | ary.tournament.we.see.in.sports, |
0a20 | 20 65 61 63 68 20 63 65 6c 6c 20 69 73 20 74 68 65 20 77 69 6e 6e 65 72 0a 6f 76 65 72 20 74 68 | .each.cell.is.the.winner.over.th |
0a40 | 65 20 74 77 6f 20 63 65 6c 6c 73 20 69 74 20 74 6f 70 73 2c 20 61 6e 64 20 77 65 20 63 61 6e 20 | e.two.cells.it.tops,.and.we.can. |
0a60 | 74 72 61 63 65 20 74 68 65 20 77 69 6e 6e 65 72 20 64 6f 77 6e 20 74 68 65 20 74 72 65 65 0a 74 | trace.the.winner.down.the.tree.t |
0a80 | 6f 20 73 65 65 20 61 6c 6c 20 6f 70 70 6f 6e 65 6e 74 73 20 73 2f 68 65 20 68 61 64 2e 20 20 48 | o.see.all.opponents.s/he.had...H |
0aa0 | 6f 77 65 76 65 72 2c 20 69 6e 20 6d 61 6e 79 20 63 6f 6d 70 75 74 65 72 20 61 70 70 6c 69 63 61 | owever,.in.many.computer.applica |
0ac0 | 74 69 6f 6e 73 0a 6f 66 20 73 75 63 68 20 74 6f 75 72 6e 61 6d 65 6e 74 73 2c 20 77 65 20 64 6f | tions.of.such.tournaments,.we.do |
0ae0 | 20 6e 6f 74 20 6e 65 65 64 20 74 6f 20 74 72 61 63 65 20 74 68 65 20 68 69 73 74 6f 72 79 20 6f | .not.need.to.trace.the.history.o |
0b00 | 66 20 61 20 77 69 6e 6e 65 72 2e 0a 54 6f 20 62 65 20 6d 6f 72 65 20 6d 65 6d 6f 72 79 20 65 66 | f.a.winner..To.be.more.memory.ef |
0b20 | 66 69 63 69 65 6e 74 2c 20 77 68 65 6e 20 61 20 77 69 6e 6e 65 72 20 69 73 20 70 72 6f 6d 6f 74 | ficient,.when.a.winner.is.promot |
0b40 | 65 64 2c 20 77 65 20 74 72 79 20 74 6f 0a 72 65 70 6c 61 63 65 20 69 74 20 62 79 20 73 6f 6d 65 | ed,.we.try.to.replace.it.by.some |
0b60 | 74 68 69 6e 67 20 65 6c 73 65 20 61 74 20 61 20 6c 6f 77 65 72 20 6c 65 76 65 6c 2c 20 61 6e 64 | thing.else.at.a.lower.level,.and |
0b80 | 20 74 68 65 20 72 75 6c 65 20 62 65 63 6f 6d 65 73 0a 74 68 61 74 20 61 20 63 65 6c 6c 20 61 6e | .the.rule.becomes.that.a.cell.an |
0ba0 | 64 20 74 68 65 20 74 77 6f 20 63 65 6c 6c 73 20 69 74 20 74 6f 70 73 20 63 6f 6e 74 61 69 6e 20 | d.the.two.cells.it.tops.contain. |
0bc0 | 74 68 72 65 65 20 64 69 66 66 65 72 65 6e 74 20 69 74 65 6d 73 2c 0a 62 75 74 20 74 68 65 20 74 | three.different.items,.but.the.t |
0be0 | 6f 70 20 63 65 6c 6c 20 22 77 69 6e 73 22 20 6f 76 65 72 20 74 68 65 20 74 77 6f 20 74 6f 70 70 | op.cell."wins".over.the.two.topp |
0c00 | 65 64 20 63 65 6c 6c 73 2e 0a 0a 49 66 20 74 68 69 73 20 68 65 61 70 20 69 6e 76 61 72 69 61 6e | ed.cells...If.this.heap.invarian |
0c20 | 74 20 69 73 20 70 72 6f 74 65 63 74 65 64 20 61 74 20 61 6c 6c 20 74 69 6d 65 2c 20 69 6e 64 65 | t.is.protected.at.all.time,.inde |
0c40 | 78 20 30 20 69 73 20 63 6c 65 61 72 6c 79 0a 74 68 65 20 6f 76 65 72 61 6c 6c 20 77 69 6e 6e 65 | x.0.is.clearly.the.overall.winne |
0c60 | 72 2e 20 20 54 68 65 20 73 69 6d 70 6c 65 73 74 20 61 6c 67 6f 72 69 74 68 6d 69 63 20 77 61 79 | r...The.simplest.algorithmic.way |
0c80 | 20 74 6f 20 72 65 6d 6f 76 65 20 69 74 20 61 6e 64 0a 66 69 6e 64 20 74 68 65 20 22 6e 65 78 74 | .to.remove.it.and.find.the."next |
0ca0 | 22 20 77 69 6e 6e 65 72 20 69 73 20 74 6f 20 6d 6f 76 65 20 73 6f 6d 65 20 6c 6f 73 65 72 20 28 | ".winner.is.to.move.some.loser.( |
0cc0 | 6c 65 74 27 73 20 73 61 79 20 63 65 6c 6c 20 33 30 20 69 6e 20 74 68 65 0a 64 69 61 67 72 61 6d | let's.say.cell.30.in.the.diagram |
0ce0 | 20 61 62 6f 76 65 29 20 69 6e 74 6f 20 74 68 65 20 30 20 70 6f 73 69 74 69 6f 6e 2c 20 61 6e 64 | .above).into.the.0.position,.and |
0d00 | 20 74 68 65 6e 20 70 65 72 63 6f 6c 61 74 65 20 74 68 69 73 20 6e 65 77 20 30 20 64 6f 77 6e 0a | .then.percolate.this.new.0.down. |
0d20 | 74 68 65 20 74 72 65 65 2c 20 65 78 63 68 61 6e 67 69 6e 67 20 76 61 6c 75 65 73 2c 20 75 6e 74 | the.tree,.exchanging.values,.unt |
0d40 | 69 6c 20 74 68 65 20 69 6e 76 61 72 69 61 6e 74 20 69 73 20 72 65 2d 65 73 74 61 62 6c 69 73 68 | il.the.invariant.is.re-establish |
0d60 | 65 64 2e 0a 54 68 69 73 20 69 73 20 63 6c 65 61 72 6c 79 20 6c 6f 67 61 72 69 74 68 6d 69 63 20 | ed..This.is.clearly.logarithmic. |
0d80 | 6f 6e 20 74 68 65 20 74 6f 74 61 6c 20 6e 75 6d 62 65 72 20 6f 66 20 69 74 65 6d 73 20 69 6e 20 | on.the.total.number.of.items.in. |
0da0 | 74 68 65 20 74 72 65 65 2e 0a 42 79 20 69 74 65 72 61 74 69 6e 67 20 6f 76 65 72 20 61 6c 6c 20 | the.tree..By.iterating.over.all. |
0dc0 | 69 74 65 6d 73 2c 20 79 6f 75 20 67 65 74 20 61 6e 20 4f 28 6e 20 6c 6e 20 6e 29 20 73 6f 72 74 | items,.you.get.an.O(n.ln.n).sort |
0de0 | 2e 0a 0a 41 20 6e 69 63 65 20 66 65 61 74 75 72 65 20 6f 66 20 74 68 69 73 20 73 6f 72 74 20 69 | ...A.nice.feature.of.this.sort.i |
0e00 | 73 20 74 68 61 74 20 79 6f 75 20 63 61 6e 20 65 66 66 69 63 69 65 6e 74 6c 79 20 69 6e 73 65 72 | s.that.you.can.efficiently.inser |
0e20 | 74 20 6e 65 77 0a 69 74 65 6d 73 20 77 68 69 6c 65 20 74 68 65 20 73 6f 72 74 20 69 73 20 67 6f | t.new.items.while.the.sort.is.go |
0e40 | 69 6e 67 20 6f 6e 2c 20 70 72 6f 76 69 64 65 64 20 74 68 61 74 20 74 68 65 20 69 6e 73 65 72 74 | ing.on,.provided.that.the.insert |
0e60 | 65 64 20 69 74 65 6d 73 20 61 72 65 0a 6e 6f 74 20 22 62 65 74 74 65 72 22 20 74 68 61 6e 20 74 | ed.items.are.not."better".than.t |
0e80 | 68 65 20 6c 61 73 74 20 30 27 74 68 20 65 6c 65 6d 65 6e 74 20 79 6f 75 20 65 78 74 72 61 63 74 | he.last.0'th.element.you.extract |
0ea0 | 65 64 2e 20 20 54 68 69 73 20 69 73 0a 65 73 70 65 63 69 61 6c 6c 79 20 75 73 65 66 75 6c 20 69 | ed...This.is.especially.useful.i |
0ec0 | 6e 20 73 69 6d 75 6c 61 74 69 6f 6e 20 63 6f 6e 74 65 78 74 73 2c 20 77 68 65 72 65 20 74 68 65 | n.simulation.contexts,.where.the |
0ee0 | 20 74 72 65 65 20 68 6f 6c 64 73 20 61 6c 6c 0a 69 6e 63 6f 6d 69 6e 67 20 65 76 65 6e 74 73 2c | .tree.holds.all.incoming.events, |
0f00 | 20 61 6e 64 20 74 68 65 20 22 77 69 6e 22 20 63 6f 6e 64 69 74 69 6f 6e 20 6d 65 61 6e 73 20 74 | .and.the."win".condition.means.t |
0f20 | 68 65 20 73 6d 61 6c 6c 65 73 74 20 73 63 68 65 64 75 6c 65 64 0a 74 69 6d 65 2e 20 20 57 68 65 | he.smallest.scheduled.time...Whe |
0f40 | 6e 20 61 6e 20 65 76 65 6e 74 20 73 63 68 65 64 75 6c 65 20 6f 74 68 65 72 20 65 76 65 6e 74 73 | n.an.event.schedule.other.events |
0f60 | 20 66 6f 72 20 65 78 65 63 75 74 69 6f 6e 2c 20 74 68 65 79 20 61 72 65 0a 73 63 68 65 64 75 6c | .for.execution,.they.are.schedul |
0f80 | 65 64 20 69 6e 74 6f 20 74 68 65 20 66 75 74 75 72 65 2c 20 73 6f 20 74 68 65 79 20 63 61 6e 20 | ed.into.the.future,.so.they.can. |
0fa0 | 65 61 73 69 6c 79 20 67 6f 20 69 6e 74 6f 20 74 68 65 20 68 65 61 70 2e 20 20 53 6f 2c 20 61 0a | easily.go.into.the.heap...So,.a. |
0fc0 | 68 65 61 70 20 69 73 20 61 20 67 6f 6f 64 20 73 74 72 75 63 74 75 72 65 20 66 6f 72 20 69 6d 70 | heap.is.a.good.structure.for.imp |
0fe0 | 6c 65 6d 65 6e 74 69 6e 67 20 73 63 68 65 64 75 6c 65 72 73 20 28 74 68 69 73 20 69 73 20 77 68 | lementing.schedulers.(this.is.wh |
1000 | 61 74 20 49 0a 75 73 65 64 20 66 6f 72 20 6d 79 20 4d 49 44 49 20 73 65 71 75 65 6e 63 65 72 20 | at.I.used.for.my.MIDI.sequencer. |
1020 | 3a 2d 29 2e 0a 0a 56 61 72 69 6f 75 73 20 73 74 72 75 63 74 75 72 65 73 20 66 6f 72 20 69 6d 70 | :-)...Various.structures.for.imp |
1040 | 6c 65 6d 65 6e 74 69 6e 67 20 73 63 68 65 64 75 6c 65 72 73 20 68 61 76 65 20 62 65 65 6e 20 65 | lementing.schedulers.have.been.e |
1060 | 78 74 65 6e 73 69 76 65 6c 79 0a 73 74 75 64 69 65 64 2c 20 61 6e 64 20 68 65 61 70 73 20 61 72 | xtensively.studied,.and.heaps.ar |
1080 | 65 20 67 6f 6f 64 20 66 6f 72 20 74 68 69 73 2c 20 61 73 20 74 68 65 79 20 61 72 65 20 72 65 61 | e.good.for.this,.as.they.are.rea |
10a0 | 73 6f 6e 61 62 6c 79 20 73 70 65 65 64 79 2c 0a 74 68 65 20 73 70 65 65 64 20 69 73 20 61 6c 6d | sonably.speedy,.the.speed.is.alm |
10c0 | 6f 73 74 20 63 6f 6e 73 74 61 6e 74 2c 20 61 6e 64 20 74 68 65 20 77 6f 72 73 74 20 63 61 73 65 | ost.constant,.and.the.worst.case |
10e0 | 20 69 73 20 6e 6f 74 20 6d 75 63 68 20 64 69 66 66 65 72 65 6e 74 0a 74 68 61 6e 20 74 68 65 20 | .is.not.much.different.than.the. |
1100 | 61 76 65 72 61 67 65 20 63 61 73 65 2e 20 20 48 6f 77 65 76 65 72 2c 20 74 68 65 72 65 20 61 72 | average.case...However,.there.ar |
1120 | 65 20 6f 74 68 65 72 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e 73 20 77 68 69 63 68 0a 61 72 | e.other.representations.which.ar |
1140 | 65 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 6f 76 65 72 61 6c 6c 2c 20 79 65 74 20 74 68 | e.more.efficient.overall,.yet.th |
1160 | 65 20 77 6f 72 73 74 20 63 61 73 65 73 20 6d 69 67 68 74 20 62 65 20 74 65 72 72 69 62 6c 65 2e | e.worst.cases.might.be.terrible. |
1180 | 0a 0a 48 65 61 70 73 20 61 72 65 20 61 6c 73 6f 20 76 65 72 79 20 75 73 65 66 75 6c 20 69 6e 20 | ..Heaps.are.also.very.useful.in. |
11a0 | 62 69 67 20 64 69 73 6b 20 73 6f 72 74 73 2e 20 20 59 6f 75 20 6d 6f 73 74 20 70 72 6f 62 61 62 | big.disk.sorts...You.most.probab |
11c0 | 6c 79 20 61 6c 6c 0a 6b 6e 6f 77 20 74 68 61 74 20 61 20 62 69 67 20 73 6f 72 74 20 69 6d 70 6c | ly.all.know.that.a.big.sort.impl |
11e0 | 69 65 73 20 70 72 6f 64 75 63 69 6e 67 20 22 72 75 6e 73 22 20 28 77 68 69 63 68 20 61 72 65 20 | ies.producing."runs".(which.are. |
1200 | 70 72 65 2d 73 6f 72 74 65 64 0a 73 65 71 75 65 6e 63 65 73 2c 20 77 68 69 63 68 20 73 69 7a 65 | pre-sorted.sequences,.which.size |
1220 | 20 69 73 20 75 73 75 61 6c 6c 79 20 72 65 6c 61 74 65 64 20 74 6f 20 74 68 65 20 61 6d 6f 75 6e | .is.usually.related.to.the.amoun |
1240 | 74 20 6f 66 20 43 50 55 20 6d 65 6d 6f 72 79 29 2c 0a 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 | t.of.CPU.memory),.followed.by.a. |
1260 | 6d 65 72 67 69 6e 67 20 70 61 73 73 65 73 20 66 6f 72 20 74 68 65 73 65 20 72 75 6e 73 2c 20 77 | merging.passes.for.these.runs,.w |
1280 | 68 69 63 68 20 6d 65 72 67 69 6e 67 20 69 73 20 6f 66 74 65 6e 0a 76 65 72 79 20 63 6c 65 76 65 | hich.merging.is.often.very.cleve |
12a0 | 72 6c 79 20 6f 72 67 61 6e 69 73 65 64 5b 31 5d 2e 20 20 49 74 20 69 73 20 76 65 72 79 20 69 6d | rly.organised[1]...It.is.very.im |
12c0 | 70 6f 72 74 61 6e 74 20 74 68 61 74 20 74 68 65 20 69 6e 69 74 69 61 6c 0a 73 6f 72 74 20 70 72 | portant.that.the.initial.sort.pr |
12e0 | 6f 64 75 63 65 73 20 74 68 65 20 6c 6f 6e 67 65 73 74 20 72 75 6e 73 20 70 6f 73 73 69 62 6c 65 | oduces.the.longest.runs.possible |
1300 | 2e 20 20 54 6f 75 72 6e 61 6d 65 6e 74 73 20 61 72 65 20 61 20 67 6f 6f 64 20 77 61 79 0a 74 6f | ...Tournaments.are.a.good.way.to |
1320 | 20 74 68 61 74 2e 20 20 49 66 2c 20 75 73 69 6e 67 20 61 6c 6c 20 74 68 65 20 6d 65 6d 6f 72 79 | .that...If,.using.all.the.memory |
1340 | 20 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 68 6f 6c 64 20 61 20 74 6f 75 72 6e 61 6d 65 6e 74 2c | .available.to.hold.a.tournament, |
1360 | 20 79 6f 75 0a 72 65 70 6c 61 63 65 20 61 6e 64 20 70 65 72 63 6f 6c 61 74 65 20 69 74 65 6d 73 | .you.replace.and.percolate.items |
1380 | 20 74 68 61 74 20 68 61 70 70 65 6e 20 74 6f 20 66 69 74 20 74 68 65 20 63 75 72 72 65 6e 74 20 | .that.happen.to.fit.the.current. |
13a0 | 72 75 6e 2c 20 79 6f 75 27 6c 6c 0a 70 72 6f 64 75 63 65 20 72 75 6e 73 20 77 68 69 63 68 20 61 | run,.you'll.produce.runs.which.a |
13c0 | 72 65 20 74 77 69 63 65 20 74 68 65 20 73 69 7a 65 20 6f 66 20 74 68 65 20 6d 65 6d 6f 72 79 20 | re.twice.the.size.of.the.memory. |
13e0 | 66 6f 72 20 72 61 6e 64 6f 6d 20 69 6e 70 75 74 2c 0a 61 6e 64 20 6d 75 63 68 20 62 65 74 74 65 | for.random.input,.and.much.bette |
1400 | 72 20 66 6f 72 20 69 6e 70 75 74 20 66 75 7a 7a 69 6c 79 20 6f 72 64 65 72 65 64 2e 0a 0a 4d 6f | r.for.input.fuzzily.ordered...Mo |
1420 | 72 65 6f 76 65 72 2c 20 69 66 20 79 6f 75 20 6f 75 74 70 75 74 20 74 68 65 20 30 27 74 68 20 69 | reover,.if.you.output.the.0'th.i |
1440 | 74 65 6d 20 6f 6e 20 64 69 73 6b 20 61 6e 64 20 67 65 74 20 61 6e 20 69 6e 70 75 74 20 77 68 69 | tem.on.disk.and.get.an.input.whi |
1460 | 63 68 0a 6d 61 79 20 6e 6f 74 20 66 69 74 20 69 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 74 6f | ch.may.not.fit.in.the.current.to |
1480 | 75 72 6e 61 6d 65 6e 74 20 28 62 65 63 61 75 73 65 20 74 68 65 20 76 61 6c 75 65 20 22 77 69 6e | urnament.(because.the.value."win |
14a0 | 73 22 20 6f 76 65 72 0a 74 68 65 20 6c 61 73 74 20 6f 75 74 70 75 74 20 76 61 6c 75 65 29 2c 20 | s".over.the.last.output.value),. |
14c0 | 69 74 20 63 61 6e 6e 6f 74 20 66 69 74 20 69 6e 20 74 68 65 20 68 65 61 70 2c 20 73 6f 20 74 68 | it.cannot.fit.in.the.heap,.so.th |
14e0 | 65 20 73 69 7a 65 20 6f 66 20 74 68 65 0a 68 65 61 70 20 64 65 63 72 65 61 73 65 73 2e 20 20 54 | e.size.of.the.heap.decreases...T |
1500 | 68 65 20 66 72 65 65 64 20 6d 65 6d 6f 72 79 20 63 6f 75 6c 64 20 62 65 20 63 6c 65 76 65 72 6c | he.freed.memory.could.be.cleverl |
1520 | 79 20 72 65 75 73 65 64 20 69 6d 6d 65 64 69 61 74 65 6c 79 0a 66 6f 72 20 70 72 6f 67 72 65 73 | y.reused.immediately.for.progres |
1540 | 73 69 76 65 6c 79 20 62 75 69 6c 64 69 6e 67 20 61 20 73 65 63 6f 6e 64 20 68 65 61 70 2c 20 77 | sively.building.a.second.heap,.w |
1560 | 68 69 63 68 20 67 72 6f 77 73 20 61 74 20 65 78 61 63 74 6c 79 20 74 68 65 0a 73 61 6d 65 20 72 | hich.grows.at.exactly.the.same.r |
1580 | 61 74 65 20 74 68 65 20 66 69 72 73 74 20 68 65 61 70 20 69 73 20 6d 65 6c 74 69 6e 67 2e 20 20 | ate.the.first.heap.is.melting... |
15a0 | 57 68 65 6e 20 74 68 65 20 66 69 72 73 74 20 68 65 61 70 20 63 6f 6d 70 6c 65 74 65 6c 79 0a 76 | When.the.first.heap.completely.v |
15c0 | 61 6e 69 73 68 65 73 2c 20 79 6f 75 20 73 77 69 74 63 68 20 68 65 61 70 73 20 61 6e 64 20 73 74 | anishes,.you.switch.heaps.and.st |
15e0 | 61 72 74 20 61 20 6e 65 77 20 72 75 6e 2e 20 20 43 6c 65 76 65 72 20 61 6e 64 20 71 75 69 74 65 | art.a.new.run...Clever.and.quite |
1600 | 0a 65 66 66 65 63 74 69 76 65 21 0a 0a 49 6e 20 61 20 77 6f 72 64 2c 20 68 65 61 70 73 20 61 72 | .effective!..In.a.word,.heaps.ar |
1620 | 65 20 75 73 65 66 75 6c 20 6d 65 6d 6f 72 79 20 73 74 72 75 63 74 75 72 65 73 20 74 6f 20 6b 6e | e.useful.memory.structures.to.kn |
1640 | 6f 77 2e 20 20 49 20 75 73 65 20 74 68 65 6d 20 69 6e 0a 61 20 66 65 77 20 61 70 70 6c 69 63 61 | ow...I.use.them.in.a.few.applica |
1660 | 74 69 6f 6e 73 2c 20 61 6e 64 20 49 20 74 68 69 6e 6b 20 69 74 20 69 73 20 67 6f 6f 64 20 74 6f | tions,.and.I.think.it.is.good.to |
1680 | 20 6b 65 65 70 20 61 20 60 68 65 61 70 27 20 6d 6f 64 75 6c 65 0a 61 72 6f 75 6e 64 2e 20 3a 2d | .keep.a.`heap'.module.around..:- |
16a0 | 29 0a 0a 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 5b 31 5d 20 54 68 65 20 | )..--------------------.[1].The. |
16c0 | 64 69 73 6b 20 62 61 6c 61 6e 63 69 6e 67 20 61 6c 67 6f 72 69 74 68 6d 73 20 77 68 69 63 68 20 | disk.balancing.algorithms.which. |
16e0 | 61 72 65 20 63 75 72 72 65 6e 74 2c 20 6e 6f 77 61 64 61 79 73 2c 20 61 72 65 0a 6d 6f 72 65 20 | are.current,.nowadays,.are.more. |
1700 | 61 6e 6e 6f 79 69 6e 67 20 74 68 61 6e 20 63 6c 65 76 65 72 2c 20 61 6e 64 20 74 68 69 73 20 69 | annoying.than.clever,.and.this.i |
1720 | 73 20 61 20 63 6f 6e 73 65 71 75 65 6e 63 65 20 6f 66 20 74 68 65 20 73 65 65 6b 69 6e 67 0a 63 | s.a.consequence.of.the.seeking.c |
1740 | 61 70 61 62 69 6c 69 74 69 65 73 20 6f 66 20 74 68 65 20 64 69 73 6b 73 2e 20 20 4f 6e 20 64 65 | apabilities.of.the.disks...On.de |
1760 | 76 69 63 65 73 20 77 68 69 63 68 20 63 61 6e 6e 6f 74 20 73 65 65 6b 2c 20 6c 69 6b 65 20 62 69 | vices.which.cannot.seek,.like.bi |
1780 | 67 0a 74 61 70 65 20 64 72 69 76 65 73 2c 20 74 68 65 20 73 74 6f 72 79 20 77 61 73 20 71 75 69 | g.tape.drives,.the.story.was.qui |
17a0 | 74 65 20 64 69 66 66 65 72 65 6e 74 2c 20 61 6e 64 20 6f 6e 65 20 68 61 64 20 74 6f 20 62 65 20 | te.different,.and.one.had.to.be. |
17c0 | 76 65 72 79 0a 63 6c 65 76 65 72 20 74 6f 20 65 6e 73 75 72 65 20 28 66 61 72 20 69 6e 20 61 64 | very.clever.to.ensure.(far.in.ad |
17e0 | 76 61 6e 63 65 29 20 74 68 61 74 20 65 61 63 68 20 74 61 70 65 20 6d 6f 76 65 6d 65 6e 74 20 77 | vance).that.each.tape.movement.w |
1800 | 69 6c 6c 20 62 65 20 74 68 65 0a 6d 6f 73 74 20 65 66 66 65 63 74 69 76 65 20 70 6f 73 73 69 62 | ill.be.the.most.effective.possib |
1820 | 6c 65 20 28 74 68 61 74 20 69 73 2c 20 77 69 6c 6c 20 62 65 73 74 20 70 61 72 74 69 63 69 70 61 | le.(that.is,.will.best.participa |
1840 | 74 65 20 61 74 0a 22 70 72 6f 67 72 65 73 73 69 6e 67 22 20 74 68 65 20 6d 65 72 67 65 29 2e 20 | te.at."progressing".the.merge).. |
1860 | 20 53 6f 6d 65 20 74 61 70 65 73 20 77 65 72 65 20 65 76 65 6e 20 61 62 6c 65 20 74 6f 20 72 65 | .Some.tapes.were.even.able.to.re |
1880 | 61 64 0a 62 61 63 6b 77 61 72 64 73 2c 20 61 6e 64 20 74 68 69 73 20 77 61 73 20 61 6c 73 6f 20 | ad.backwards,.and.this.was.also. |
18a0 | 75 73 65 64 20 74 6f 20 61 76 6f 69 64 20 74 68 65 20 72 65 77 69 6e 64 69 6e 67 20 74 69 6d 65 | used.to.avoid.the.rewinding.time |
18c0 | 2e 0a 42 65 6c 69 65 76 65 20 6d 65 2c 20 72 65 61 6c 20 67 6f 6f 64 20 74 61 70 65 20 73 6f 72 | ..Believe.me,.real.good.tape.sor |
18e0 | 74 73 20 77 65 72 65 20 71 75 69 74 65 20 73 70 65 63 74 61 63 75 6c 61 72 20 74 6f 20 77 61 74 | ts.were.quite.spectacular.to.wat |
1900 | 63 68 21 0a 46 72 6f 6d 20 61 6c 6c 20 74 69 6d 65 73 2c 20 73 6f 72 74 69 6e 67 20 68 61 73 20 | ch!.From.all.times,.sorting.has. |
1920 | 61 6c 77 61 79 73 20 62 65 65 6e 20 61 20 47 72 65 61 74 20 41 72 74 21 20 3a 2d 29 0a 74 08 00 | always.been.a.Great.Art!.:-).t.. |
1940 | 00 00 68 65 61 70 70 75 73 68 74 07 00 00 00 68 65 61 70 70 6f 70 74 07 00 00 00 68 65 61 70 69 | ..heappusht....heappopt....heapi |
1960 | 66 79 74 0b 00 00 00 68 65 61 70 72 65 70 6c 61 63 65 74 08 00 00 00 6e 6c 61 72 67 65 73 74 74 | fyt....heapreplacet....nlargestt |
1980 | 09 00 00 00 6e 73 6d 61 6c 6c 65 73 74 69 ff ff ff ff 28 06 00 00 00 74 06 00 00 00 69 73 6c 69 | ....nsmallesti....(....t....isli |
19a0 | 63 65 74 06 00 00 00 72 65 70 65 61 74 74 05 00 00 00 63 6f 75 6e 74 74 04 00 00 00 69 6d 61 70 | cet....repeatt....countt....imap |
19c0 | 74 04 00 00 00 69 7a 69 70 74 03 00 00 00 74 65 65 28 02 00 00 00 74 0a 00 00 00 69 74 65 6d 67 | t....izipt....tee(....t....itemg |
19e0 | 65 74 74 65 72 74 03 00 00 00 6e 65 67 4e 63 02 00 00 00 02 00 00 00 05 00 00 00 43 00 00 00 73 | ettert....negNc............C...s |
1a00 | 2b 00 00 00 7c 00 00 69 00 00 7c 01 00 83 01 00 01 74 01 00 7c 00 00 64 01 00 74 02 00 7c 00 00 | +...|..i..|......t..|..d..t..|.. |
1a20 | 83 01 00 64 02 00 18 83 03 00 01 64 03 00 53 28 04 00 00 00 73 34 00 00 00 50 75 73 68 20 69 74 | ...d.......d..S(....s4...Push.it |
1a40 | 65 6d 20 6f 6e 74 6f 20 68 65 61 70 2c 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 65 20 68 65 | em.onto.heap,.maintaining.the.he |
1a60 | 61 70 20 69 6e 76 61 72 69 61 6e 74 2e 69 00 00 00 00 69 01 00 00 00 4e 28 03 00 00 00 74 06 00 | ap.invariant.i....i....N(....t.. |
1a80 | 00 00 61 70 70 65 6e 64 74 09 00 00 00 5f 73 69 66 74 64 6f 77 6e 74 03 00 00 00 6c 65 6e 28 02 | ..appendt...._siftdownt....len(. |
1aa0 | 00 00 00 74 04 00 00 00 68 65 61 70 74 04 00 00 00 69 74 65 6d 28 00 00 00 00 28 00 00 00 00 73 | ...t....heapt....item(....(....s |
1ac0 | 18 00 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 00 00 00 | ..../sys/lib/python/heapq.pyR... |
1ae0 | 00 88 00 00 00 73 04 00 00 00 00 02 0d 01 63 01 00 00 00 03 00 00 00 03 00 00 00 43 00 00 00 73 | .....s........c............C...s |
1b00 | 42 00 00 00 7c 00 00 69 00 00 83 00 00 7d 01 00 7c 00 00 6f 25 00 01 7c 00 00 64 01 00 19 7d 02 | B...|..i.....}..|..o%..|..d...}. |
1b20 | 00 7c 01 00 7c 00 00 64 01 00 3c 74 01 00 7c 00 00 64 01 00 83 02 00 01 6e 07 00 01 7c 01 00 7d | .|..|..d..<t..|..d......n...|..} |
1b40 | 02 00 7c 02 00 53 28 02 00 00 00 73 43 00 00 00 50 6f 70 20 74 68 65 20 73 6d 61 6c 6c 65 73 74 | ..|..S(....sC...Pop.the.smallest |
1b60 | 20 69 74 65 6d 20 6f 66 66 20 74 68 65 20 68 65 61 70 2c 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 | .item.off.the.heap,.maintaining. |
1b80 | 74 68 65 20 68 65 61 70 20 69 6e 76 61 72 69 61 6e 74 2e 69 00 00 00 00 28 02 00 00 00 74 03 00 | the.heap.invariant.i....(....t.. |
1ba0 | 00 00 70 6f 70 74 07 00 00 00 5f 73 69 66 74 75 70 28 03 00 00 00 52 11 00 00 00 74 07 00 00 00 | ..popt...._siftup(....R....t.... |
1bc0 | 6c 61 73 74 65 6c 74 74 0a 00 00 00 72 65 74 75 72 6e 69 74 65 6d 28 00 00 00 00 28 00 00 00 00 | lasteltt....returnitem(....(.... |
1be0 | 73 18 00 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 01 00 | s..../sys/lib/python/heapq.pyR.. |
1c00 | 00 00 8d 00 00 00 73 0e 00 00 00 00 02 0c 01 07 01 0a 01 0a 01 11 02 06 01 63 02 00 00 00 03 00 | ......s..................c...... |
1c20 | 00 00 03 00 00 00 43 00 00 00 73 25 00 00 00 7c 00 00 64 01 00 19 7d 02 00 7c 01 00 7c 00 00 64 | ......C...s%...|..d...}..|..|..d |
1c40 | 01 00 3c 74 00 00 7c 00 00 64 01 00 83 02 00 01 7c 02 00 53 28 02 00 00 00 73 b2 01 00 00 50 6f | ..<t..|..d......|..S(....s....Po |
1c60 | 70 20 61 6e 64 20 72 65 74 75 72 6e 20 74 68 65 20 63 75 72 72 65 6e 74 20 73 6d 61 6c 6c 65 73 | p.and.return.the.current.smalles |
1c80 | 74 20 76 61 6c 75 65 2c 20 61 6e 64 20 61 64 64 20 74 68 65 20 6e 65 77 20 69 74 65 6d 2e 0a 0a | t.value,.and.add.the.new.item... |
1ca0 | 20 20 20 20 54 68 69 73 20 69 73 20 6d 6f 72 65 20 65 66 66 69 63 69 65 6e 74 20 74 68 61 6e 20 | ....This.is.more.efficient.than. |
1cc0 | 68 65 61 70 70 6f 70 28 29 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 68 65 61 70 70 75 73 68 28 29 | heappop().followed.by.heappush() |
1ce0 | 2c 20 61 6e 64 20 63 61 6e 20 62 65 0a 20 20 20 20 6d 6f 72 65 20 61 70 70 72 6f 70 72 69 61 74 | ,.and.can.be.....more.appropriat |
1d00 | 65 20 77 68 65 6e 20 75 73 69 6e 67 20 61 20 66 69 78 65 64 2d 73 69 7a 65 20 68 65 61 70 2e 20 | e.when.using.a.fixed-size.heap.. |
1d20 | 20 4e 6f 74 65 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 0a 20 20 20 20 72 65 74 75 72 6e 65 | .Note.that.the.value.....returne |
1d40 | 64 20 6d 61 79 20 62 65 20 6c 61 72 67 65 72 20 74 68 61 6e 20 69 74 65 6d 21 20 20 54 68 61 74 | d.may.be.larger.than.item!..That |
1d60 | 20 63 6f 6e 73 74 72 61 69 6e 73 20 72 65 61 73 6f 6e 61 62 6c 65 20 75 73 65 73 20 6f 66 0a 20 | .constrains.reasonable.uses.of.. |
1d80 | 20 20 20 74 68 69 73 20 72 6f 75 74 69 6e 65 20 75 6e 6c 65 73 73 20 77 72 69 74 74 65 6e 20 61 | ...this.routine.unless.written.a |
1da0 | 73 20 70 61 72 74 20 6f 66 20 61 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 72 65 70 6c 61 63 65 6d | s.part.of.a.conditional.replacem |
1dc0 | 65 6e 74 3a 0a 0a 20 20 20 20 20 20 20 20 69 66 20 69 74 65 6d 20 3e 20 68 65 61 70 5b 30 5d 3a | ent:..........if.item.>.heap[0]: |
1de0 | 0a 20 20 20 20 20 20 20 20 20 20 20 20 69 74 65 6d 20 3d 20 68 65 61 70 72 65 70 6c 61 63 65 28 | .............item.=.heapreplace( |
1e00 | 68 65 61 70 2c 20 69 74 65 6d 29 0a 20 20 20 20 69 00 00 00 00 28 01 00 00 00 52 14 00 00 00 28 | heap,.item).....i....(....R....( |
1e20 | 03 00 00 00 52 11 00 00 00 52 12 00 00 00 52 16 00 00 00 28 00 00 00 00 28 00 00 00 00 73 18 00 | ....R....R....R....(....(....s.. |
1e40 | 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 03 00 00 00 98 | ../sys/lib/python/heapq.pyR..... |
1e60 | 00 00 00 73 08 00 00 00 00 0b 0a 01 0a 01 0d 01 63 01 00 00 00 03 00 00 00 04 00 00 00 43 00 00 | ...s............c............C.. |
1e80 | 00 73 3e 00 00 00 74 00 00 7c 00 00 83 01 00 7d 01 00 78 2b 00 74 01 00 74 02 00 7c 01 00 64 01 | .s>...t..|.....}..x+.t..t..|..d. |
1ea0 | 00 1a 83 01 00 83 01 00 44 5d 13 00 7d 02 00 74 03 00 7c 00 00 7c 02 00 83 02 00 01 71 23 00 57 | ........D]..}..t..|..|......q#.W |
1ec0 | 64 02 00 53 28 03 00 00 00 73 3b 00 00 00 54 72 61 6e 73 66 6f 72 6d 20 6c 69 73 74 20 69 6e 74 | d..S(....s;...Transform.list.int |
1ee0 | 6f 20 61 20 68 65 61 70 2c 20 69 6e 2d 70 6c 61 63 65 2c 20 69 6e 20 4f 28 6c 65 6e 28 68 65 61 | o.a.heap,.in-place,.in.O(len(hea |
1f00 | 70 29 29 20 74 69 6d 65 2e 69 02 00 00 00 4e 28 04 00 00 00 52 10 00 00 00 74 08 00 00 00 72 65 | p)).time.i....N(....R....t....re |
1f20 | 76 65 72 73 65 64 74 06 00 00 00 78 72 61 6e 67 65 52 14 00 00 00 28 03 00 00 00 74 01 00 00 00 | versedt....xrangeR....(....t.... |
1f40 | 78 74 01 00 00 00 6e 74 01 00 00 00 69 28 00 00 00 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 | xt....nt....i(....(....s..../sys |
1f60 | 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 02 00 00 00 a8 00 00 00 73 08 00 | /lib/python/heapq.pyR........s.. |
1f80 | 00 00 00 02 0c 06 17 00 06 01 63 02 00 00 00 07 00 00 00 05 00 00 00 43 00 00 00 73 9a 00 00 00 | ..........c............C...s.... |
1fa0 | 74 00 00 7c 01 00 83 01 00 7d 02 00 74 01 00 74 02 00 7c 02 00 7c 00 00 83 02 00 83 01 00 7d 03 | t..|.....}..t..t..|..|........}. |
1fc0 | 00 7c 03 00 70 08 00 01 7c 03 00 53 6e 01 00 01 74 03 00 7c 03 00 83 01 00 01 74 04 00 7d 04 00 | .|..p...|..Sn...t..|......t..}.. |
1fe0 | 7c 03 00 64 01 00 19 7d 05 00 78 39 00 7c 02 00 44 5d 31 00 7d 06 00 7c 06 00 7c 05 00 6a 01 00 | |..d...}..x9.|..D]1.}..|..|..j.. |
2000 | 6f 07 00 01 71 51 00 6e 01 00 01 7c 04 00 7c 03 00 7c 06 00 83 02 00 01 7c 03 00 64 01 00 19 7d | o...qQ.n...|..|..|......|..d...} |
2020 | 05 00 71 51 00 57 7c 03 00 69 05 00 64 02 00 74 06 00 83 00 01 01 7c 03 00 53 28 03 00 00 00 73 | ..qQ.W|..i..d..t......|..S(....s |
2040 | 66 00 00 00 46 69 6e 64 20 74 68 65 20 6e 20 6c 61 72 67 65 73 74 20 65 6c 65 6d 65 6e 74 73 20 | f...Find.the.n.largest.elements. |
2060 | 69 6e 20 61 20 64 61 74 61 73 65 74 2e 0a 0a 20 20 20 20 45 71 75 69 76 61 6c 65 6e 74 20 74 6f | in.a.dataset.......Equivalent.to |
2080 | 3a 20 20 73 6f 72 74 65 64 28 69 74 65 72 61 62 6c 65 2c 20 72 65 76 65 72 73 65 3d 54 72 75 65 | :..sorted(iterable,.reverse=True |
20a0 | 29 5b 3a 6e 5d 0a 20 20 20 20 69 00 00 00 00 74 07 00 00 00 72 65 76 65 72 73 65 28 07 00 00 00 | )[:n].....i....t....reverse(.... |
20c0 | 74 04 00 00 00 69 74 65 72 74 04 00 00 00 6c 69 73 74 52 06 00 00 00 52 02 00 00 00 52 03 00 00 | t....itert....listR....R....R... |
20e0 | 00 74 04 00 00 00 73 6f 72 74 74 04 00 00 00 54 72 75 65 28 07 00 00 00 52 1a 00 00 00 74 08 00 | .t....sortt....True(....R....t.. |
2100 | 00 00 69 74 65 72 61 62 6c 65 74 02 00 00 00 69 74 74 06 00 00 00 72 65 73 75 6c 74 74 0c 00 00 | ..iterablet....itt....resultt... |
2120 | 00 5f 68 65 61 70 72 65 70 6c 61 63 65 74 03 00 00 00 73 6f 6c 74 04 00 00 00 65 6c 65 6d 28 00 | ._heapreplacet....solt....elem(. |
2140 | 00 00 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 | ...(....s..../sys/lib/python/hea |
2160 | 70 71 2e 70 79 52 04 00 00 00 b3 00 00 00 73 1e 00 00 00 00 05 0c 01 15 01 07 01 08 01 0a 01 06 | pq.pyR........s................. |
2180 | 01 0a 01 07 00 06 01 0d 01 07 01 0d 01 0e 01 10 01 63 02 00 00 00 09 00 00 00 0a 00 00 00 43 00 | .................c............C. |
21a0 | 00 00 73 fc 00 00 00 74 00 00 7c 01 00 64 01 00 83 02 00 6f b1 00 01 7c 00 00 64 02 00 14 74 01 | ..s....t..|..d.....o...|..d...t. |
21c0 | 00 7c 01 00 83 01 00 6a 01 00 6f 9a 00 01 74 02 00 7c 01 00 83 01 00 7d 02 00 74 03 00 74 04 00 | .|.....j..o...t..|.....}..t..t.. |
21e0 | 7c 02 00 64 03 00 7c 00 00 83 03 00 83 01 00 7d 03 00 7c 03 00 70 08 00 01 7c 03 00 53 6e 01 00 | |..d..|........}..|..p...|..Sn.. |
2200 | 01 74 05 00 69 06 00 7d 04 00 7c 03 00 69 07 00 7d 05 00 7c 03 00 64 04 00 19 7d 06 00 78 40 00 | .t..i..}..|..i..}..|..d...}..x@. |
2220 | 7c 02 00 44 5d 38 00 7d 07 00 7c 06 00 7c 07 00 6a 01 00 6f 07 00 01 71 7d 00 6e 01 00 01 7c 04 | |..D]8.}..|..|..j..o...q}.n...|. |
2240 | 00 7c 03 00 7c 07 00 83 02 00 01 7c 05 00 83 00 00 01 7c 03 00 64 04 00 19 7d 06 00 71 7d 00 57 | .|..|......|......|..d...}..q}.W |
2260 | 7c 03 00 53 6e 01 00 01 74 08 00 7c 01 00 83 01 00 7d 08 00 74 09 00 7c 08 00 83 01 00 01 74 0a | |..Sn...t..|.....}..t..|......t. |
2280 | 00 74 0b 00 74 0c 00 7c 08 00 74 0d 00 7c 00 00 74 01 00 7c 08 00 83 01 00 83 02 00 83 02 00 83 | .t..t..|..t..|..t..|............ |
22a0 | 02 00 53 28 05 00 00 00 73 59 00 00 00 46 69 6e 64 20 74 68 65 20 6e 20 73 6d 61 6c 6c 65 73 74 | ..S(....sY...Find.the.n.smallest |
22c0 | 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 61 20 64 61 74 61 73 65 74 2e 0a 0a 20 20 20 20 45 71 75 | .elements.in.a.dataset.......Equ |
22e0 | 69 76 61 6c 65 6e 74 20 74 6f 3a 20 20 73 6f 72 74 65 64 28 69 74 65 72 61 62 6c 65 29 5b 3a 6e | ivalent.to:..sorted(iterable)[:n |
2300 | 5d 0a 20 20 20 20 74 07 00 00 00 5f 5f 6c 65 6e 5f 5f 69 0a 00 00 00 69 00 00 00 00 69 ff ff ff | ].....t....__len__i....i....i... |
2320 | ff 28 0e 00 00 00 74 07 00 00 00 68 61 73 61 74 74 72 52 10 00 00 00 52 1d 00 00 00 74 06 00 00 | .(....t....hasattrR....R....t... |
2340 | 00 73 6f 72 74 65 64 52 06 00 00 00 74 06 00 00 00 62 69 73 65 63 74 74 06 00 00 00 69 6e 73 6f | .sortedR....t....bisectt....inso |
2360 | 72 74 52 13 00 00 00 52 1e 00 00 00 52 02 00 00 00 74 03 00 00 00 6d 61 70 52 01 00 00 00 52 07 | rtR....R....R....t....mapR....R. |
2380 | 00 00 00 74 03 00 00 00 6d 69 6e 28 09 00 00 00 52 1a 00 00 00 52 21 00 00 00 52 22 00 00 00 52 | ...t....min(....R....R!...R"...R |
23a0 | 23 00 00 00 52 2b 00 00 00 52 13 00 00 00 74 03 00 00 00 6c 6f 73 52 26 00 00 00 74 01 00 00 00 | #...R+...R....t....losR&...t.... |
23c0 | 68 28 00 00 00 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f | h(....(....s..../sys/lib/python/ |
23e0 | 68 65 61 70 71 2e 70 79 52 05 00 00 00 c7 00 00 00 73 26 00 00 00 00 05 27 03 0c 01 18 01 07 01 | heapq.pyR........s&.....'....... |
2400 | 08 01 09 01 09 01 0a 01 07 00 06 01 0d 01 07 01 0d 01 07 01 0e 01 08 06 0c 01 0a 01 63 03 00 00 | ............................c... |
2420 | 00 06 00 00 00 03 00 00 00 43 00 00 00 73 67 00 00 00 7c 00 00 7c 02 00 19 7d 03 00 78 4c 00 7c | .........C...sg...|..|...}..xL.| |
2440 | 02 00 7c 01 00 6a 04 00 6f 3e 00 01 7c 02 00 64 01 00 18 64 01 00 3f 7d 04 00 7c 00 00 7c 04 00 | ..|..j..o>..|..d...d..?}..|..|.. |
2460 | 19 7d 05 00 7c 05 00 7c 03 00 6a 01 00 6f 05 00 01 50 6e 01 00 01 7c 05 00 7c 00 00 7c 02 00 3c | .}..|..|..j..o...Pn...|..|..|..< |
2480 | 7c 04 00 7d 02 00 71 0d 00 01 57 7c 03 00 7c 00 00 7c 02 00 3c 64 00 00 53 28 02 00 00 00 4e 69 | |..}..q...W|..|..|..<d..S(....Ni |
24a0 | 01 00 00 00 28 00 00 00 00 28 06 00 00 00 52 11 00 00 00 74 08 00 00 00 73 74 61 72 74 70 6f 73 | ....(....(....R....t....startpos |
24c0 | 74 03 00 00 00 70 6f 73 74 07 00 00 00 6e 65 77 69 74 65 6d 74 09 00 00 00 70 61 72 65 6e 74 70 | t....post....newitemt....parentp |
24e0 | 6f 73 74 06 00 00 00 70 61 72 65 6e 74 28 00 00 00 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 | ost....parent(....(....s..../sys |
2500 | 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 0f 00 00 00 e9 00 00 00 73 12 00 | /lib/python/heapq.pyR........s.. |
2520 | 00 00 00 01 0a 03 10 01 0e 01 0a 01 0d 01 05 01 0a 01 0b 01 63 02 00 00 00 07 00 00 00 04 00 00 | ....................c........... |
2540 | 00 43 00 00 00 73 b5 00 00 00 74 00 00 7c 00 00 83 01 00 7d 02 00 7c 01 00 7d 03 00 7c 00 00 7c | .C...s....t..|.....}..|..}..|..| |
2560 | 01 00 19 7d 04 00 64 01 00 7c 01 00 14 64 02 00 17 7d 05 00 78 6a 00 7c 05 00 7c 02 00 6a 00 00 | ...}..d..|...d...}..xj.|..|..j.. |
2580 | 6f 5c 00 01 7c 05 00 64 02 00 17 7d 06 00 7c 06 00 7c 02 00 6a 00 00 6f 1f 00 01 7c 00 00 7c 06 | o\..|..d...}..|..|..j..o...|..|. |
25a0 | 00 19 7c 00 00 7c 05 00 19 6a 01 00 6f 0a 00 01 7c 06 00 7d 05 00 6e 01 00 01 7c 00 00 7c 05 00 | ..|..|...j..o...|..}..n...|..|.. |
25c0 | 19 7c 00 00 7c 01 00 3c 7c 05 00 7d 01 00 64 01 00 7c 01 00 14 64 02 00 17 7d 05 00 71 2d 00 01 | .|..|..<|..}..d..|...d...}..q-.. |
25e0 | 57 7c 04 00 7c 00 00 7c 01 00 3c 74 01 00 7c 00 00 7c 03 00 7c 01 00 83 03 00 01 64 00 00 53 28 | W|..|..|..<t..|..|..|......d..S( |
2600 | 03 00 00 00 4e 69 02 00 00 00 69 01 00 00 00 28 02 00 00 00 52 10 00 00 00 52 0f 00 00 00 28 07 | ....Ni....i....(....R....R....(. |
2620 | 00 00 00 52 11 00 00 00 52 31 00 00 00 74 06 00 00 00 65 6e 64 70 6f 73 52 30 00 00 00 52 32 00 | ...R....R1...t....endposR0...R2. |
2640 | 00 00 74 08 00 00 00 63 68 69 6c 64 70 6f 73 74 08 00 00 00 72 69 67 68 74 70 6f 73 28 00 00 00 | ..t....childpost....rightpos(... |
2660 | 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 | .(....s..../sys/lib/python/heapq |
2680 | 2e 70 79 52 14 00 00 00 1d 01 00 00 73 1a 00 00 00 00 01 0c 01 06 01 0a 02 0e 01 10 02 0a 01 22 | .pyR........s.................." |
26a0 | 01 0a 02 0e 01 06 01 13 03 0a 01 28 06 00 00 00 52 00 00 00 00 52 01 00 00 00 52 02 00 00 00 52 | ...........(....R....R....R....R |
26c0 | 03 00 00 00 52 04 00 00 00 52 05 00 00 00 63 03 00 00 00 07 00 00 00 04 00 00 00 43 00 00 00 73 | ....R....R....c............C...s |
26e0 | 52 00 00 00 74 00 00 7c 01 00 83 01 00 5c 02 00 7d 03 00 7d 04 00 74 01 00 74 02 00 7c 02 00 7c | R...t..|.....\..}..}..t..t..|..| |
2700 | 03 00 83 02 00 74 03 00 83 00 00 7c 04 00 83 03 00 7d 05 00 74 04 00 7c 00 00 7c 05 00 83 02 00 | .....t.....|.....}..t..|..|..... |
2720 | 7d 06 00 74 05 00 74 06 00 64 01 00 83 01 00 7c 06 00 83 02 00 53 28 02 00 00 00 73 62 00 00 00 | }..t..t..d.....|.....S(....sb... |
2740 | 46 69 6e 64 20 74 68 65 20 6e 20 73 6d 61 6c 6c 65 73 74 20 65 6c 65 6d 65 6e 74 73 20 69 6e 20 | Find.the.n.smallest.elements.in. |
2760 | 61 20 64 61 74 61 73 65 74 2e 0a 0a 20 20 20 20 45 71 75 69 76 61 6c 65 6e 74 20 74 6f 3a 20 20 | a.dataset.......Equivalent.to:.. |
2780 | 73 6f 72 74 65 64 28 69 74 65 72 61 62 6c 65 2c 20 6b 65 79 3d 6b 65 79 29 5b 3a 6e 5d 0a 20 20 | sorted(iterable,.key=key)[:n]... |
27a0 | 20 20 69 02 00 00 00 28 07 00 00 00 52 0b 00 00 00 52 0a 00 00 00 52 09 00 00 00 52 08 00 00 00 | ..i....(....R....R....R....R.... |
27c0 | 74 0a 00 00 00 5f 6e 73 6d 61 6c 6c 65 73 74 52 2c 00 00 00 52 0c 00 00 00 28 07 00 00 00 52 1a | t...._nsmallestR,...R....(....R. |
27e0 | 00 00 00 52 21 00 00 00 74 03 00 00 00 6b 65 79 74 03 00 00 00 69 6e 31 74 03 00 00 00 69 6e 32 | ...R!...t....keyt....in1t....in2 |
2800 | 52 22 00 00 00 52 23 00 00 00 28 00 00 00 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 2f 6c 69 | R"...R#...(....(....s..../sys/li |
2820 | 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 05 00 00 00 39 01 00 00 73 08 00 00 00 00 | b/python/heapq.pyR....9...s..... |
2840 | 05 12 01 1e 01 0f 01 63 03 00 00 00 07 00 00 00 05 00 00 00 43 00 00 00 73 5b 00 00 00 74 00 00 | .......c............C...s[...t.. |
2860 | 7c 01 00 83 01 00 5c 02 00 7d 03 00 7d 04 00 74 01 00 74 02 00 7c 02 00 7c 03 00 83 02 00 74 02 | |.....\..}..}..t..t..|..|.....t. |
2880 | 00 74 03 00 74 04 00 83 00 00 83 02 00 7c 04 00 83 03 00 7d 05 00 74 05 00 7c 00 00 7c 05 00 83 | .t..t........|.....}..t..|..|... |
28a0 | 02 00 7d 06 00 74 06 00 74 07 00 64 01 00 83 01 00 7c 06 00 83 02 00 53 28 02 00 00 00 73 6f 00 | ..}..t..t..d.....|.....S(....so. |
28c0 | 00 00 46 69 6e 64 20 74 68 65 20 6e 20 6c 61 72 67 65 73 74 20 65 6c 65 6d 65 6e 74 73 20 69 6e | ..Find.the.n.largest.elements.in |
28e0 | 20 61 20 64 61 74 61 73 65 74 2e 0a 0a 20 20 20 20 45 71 75 69 76 61 6c 65 6e 74 20 74 6f 3a 20 | .a.dataset.......Equivalent.to:. |
2900 | 20 73 6f 72 74 65 64 28 69 74 65 72 61 62 6c 65 2c 20 6b 65 79 3d 6b 65 79 2c 20 72 65 76 65 72 | .sorted(iterable,.key=key,.rever |
2920 | 73 65 3d 54 72 75 65 29 5b 3a 6e 5d 0a 20 20 20 20 69 02 00 00 00 28 08 00 00 00 52 0b 00 00 00 | se=True)[:n].....i....(....R.... |
2940 | 52 0a 00 00 00 52 09 00 00 00 52 0d 00 00 00 52 08 00 00 00 74 09 00 00 00 5f 6e 6c 61 72 67 65 | R....R....R....R....t...._nlarge |
2960 | 73 74 52 2c 00 00 00 52 0c 00 00 00 28 07 00 00 00 52 1a 00 00 00 52 21 00 00 00 52 39 00 00 00 | stR,...R....(....R....R!...R9... |
2980 | 52 3a 00 00 00 52 3b 00 00 00 52 22 00 00 00 52 23 00 00 00 28 00 00 00 00 28 00 00 00 00 73 18 | R:...R;...R"...R#...(....(....s. |
29a0 | 00 00 00 2f 73 79 73 2f 6c 69 62 2f 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 52 04 00 00 00 | .../sys/lib/python/heapq.pyR.... |
29c0 | 44 01 00 00 73 08 00 00 00 00 05 12 01 27 01 0f 01 74 08 00 00 00 5f 5f 6d 61 69 6e 5f 5f 69 01 | D...s........'...t....__main__i. |
29e0 | 00 00 00 69 03 00 00 00 69 05 00 00 00 69 07 00 00 00 69 09 00 00 00 69 02 00 00 00 69 04 00 00 | ...i....i....i....i....i....i... |
2a00 | 00 69 06 00 00 00 69 08 00 00 00 69 00 00 00 00 28 21 00 00 00 74 07 00 00 00 5f 5f 64 6f 63 5f | .i....i....i....(!...t....__doc_ |
2a20 | 5f 74 09 00 00 00 5f 5f 61 62 6f 75 74 5f 5f 74 07 00 00 00 5f 5f 61 6c 6c 5f 5f 74 09 00 00 00 | _t....__about__t....__all__t.... |
2a40 | 69 74 65 72 74 6f 6f 6c 73 52 06 00 00 00 52 07 00 00 00 52 08 00 00 00 52 09 00 00 00 52 0a 00 | itertoolsR....R....R....R....R.. |
2a60 | 00 00 52 0b 00 00 00 74 08 00 00 00 6f 70 65 72 61 74 6f 72 52 0c 00 00 00 52 0d 00 00 00 52 2a | ..R....t....operatorR....R....R* |
2a80 | 00 00 00 52 00 00 00 00 52 01 00 00 00 52 03 00 00 00 52 02 00 00 00 52 04 00 00 00 52 05 00 00 | ...R....R....R....R....R....R... |
2aa0 | 00 52 0f 00 00 00 52 14 00 00 00 74 06 00 00 00 5f 68 65 61 70 71 74 0b 00 00 00 49 6d 70 6f 72 | .R....R....t...._heapqt....Impor |
2ac0 | 74 45 72 72 6f 72 52 38 00 00 00 74 04 00 00 00 4e 6f 6e 65 52 3c 00 00 00 74 08 00 00 00 5f 5f | tErrorR8...t....NoneR<...t....__ |
2ae0 | 6e 61 6d 65 5f 5f 52 11 00 00 00 74 04 00 00 00 64 61 74 61 52 12 00 00 00 52 1f 00 00 00 52 0e | name__R....t....dataR....R....R. |
2b00 | 00 00 00 28 00 00 00 00 28 00 00 00 00 28 00 00 00 00 73 18 00 00 00 2f 73 79 73 2f 6c 69 62 2f | ...(....(....(....s..../sys/lib/ |
2b20 | 70 79 74 68 6f 6e 2f 68 65 61 70 71 2e 70 79 73 08 00 00 00 3c 6d 6f 64 75 6c 65 3e 1f 00 00 00 | python/heapq.pys....<module>.... |
2b40 | 73 40 00 00 00 06 60 06 02 0f 01 09 02 2e 01 16 01 0c 02 09 05 09 0b 09 10 09 0b 09 14 09 22 09 | s@....`.......................". |
2b60 | 34 09 15 03 01 32 01 0e 01 05 03 06 01 0c 0a 06 01 0c 0a 0d 02 06 01 24 01 07 00 06 01 11 01 06 | 4....2.................$........ |
2b80 | 01 0a 01 18 01 | ..... |