博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
2018.4.31
阅读量:4167 次
发布时间:2019-05-26

本文共 1371 字,大约阅读时间需要 4 分钟。

2018.4.31

method Heapify(a: array
) modifies a; requires a != null; requires a.Length > 0; ensures heap(a, a.Length - 1); ensures multiset(a[..]) == multiset(old(a[..])); {
var i := 1; while (i < a.Length) invariant 0 < i <= a.Length; invariant heap(a, i - 1); invariant multiset(a[..]) == multiset(old(a[..])); {
var j := i; while (j > 0 && a[(j - 1) / 2] < a[j]) // Bubble up invariant 0 <= j <= i; invariant heapExceptJParent(a, i, j); invariant multiset(a[..]) == multiset(old(a[..])); {
Swap(a, (j - 1) / 2, j); j := (j - 1) / 2; } i := i + 1; } }

在这里插入图片描述

转载地址:http://clwai.baihongyu.com/

你可能感兴趣的文章
Pentaho 开发: 在eclipse中构建Pentaho BI Server工程
查看>>
android中SharedPreferences的简单例子
查看>>
android中使用TextView来显示某个网址的内容,使用<ScrollView>来生成下拉列表框
查看>>
andorid里关于wifi的分析
查看>>
Hibernate和IBatis对比
查看>>
Spring MVC 教程,快速入门,深入分析
查看>>
Android 的source (需安装 git repo)
查看>>
LOCAL_PRELINK_MODULE和prelink-linux-arm.map
查看>>
Ubuntu Navicat for MySQL安装以及破解方案
查看>>
java多线程中的join方法详解
查看>>
idea添加gradle模块报错The project is already registered
查看>>
在C++中如何实现模板函数的外部调用
查看>>
HTML5学习之——HTML 5 拖放
查看>>
HTML5学习之——HTML 5 Canvas vs. SVG
查看>>
HTML5学习之——HTML 5 应用程序缓存
查看>>
HTML5学习之——HTML 5 Web Workers
查看>>
HTML5学习之——HTML 5 Canvas
查看>>
HTML5学习之——HTML5 内联 SVG
查看>>
HTML5学习之——HTML 5 服务器发送事件
查看>>
SVG学习之——HTML 页面中的 SVG
查看>>