电脑桌面
添加小米粒文库到电脑桌面
安装后可以在桌面快捷访问

服务计算概论作业报告

服务计算概论作业报告_第1页
服务计算概论作业报告_第2页
服务计算概论作业报告_第3页
慕测平台测试报告(二) 学 院:计算机学院 姓 名:红娜专 业:软件工程 学 号:3130608003 班 级:1301 完成日期:2024-10-222024 年 10 月 22 日1.题目针对以下 4 个项目编写测试用例进行测试。代码如下:题目(1)// BinaryHeap class//// CONSTRUCTION: with optional capacity (that defaults to 100)//// ******************PUBLIC OPERATIONS*********************// void insert( x ) --> Insert x// int deleteMin( )--> Return and remove smallest item// int findMin( ) --> Return smallest item// boolean isEmpty( ) --> Return true if empty; else false// boolean isFull( ) --> Return true if full; else false// void makeEmpty( ) --> Remove all items// ******************ERRORS********************************// Throws Overflow if capacity exceeded/** * Implements a binary heap. * Note that all "matching" is based on the compareTo method. * author Mark AllenWeiss */publicclass BinaryHeap{ // invariant wellFormed(); /** * Construct the binary heap. */public BinaryHeap( ) {this( DEFAULT_CAPACITY ); } /** * Construct the binary heap. * param capacity the capacity of the binary heap. */ // requires capacity > 0; // ensures isEmpty();public BinaryHeap( int capacity ) { currentSize = 0; array = newint[ capacity + 1 ]; } /** * Insert into the priority queue, maintaining heap order. * Duplicates are allowed. * param x the item to insert. * exception Overflow if container is full. */publicvoid insert( int x ) throws Overflow {if( isFull( ) )thrownew Overflow( ); // Percolate upint hole = ++currentSize;for( ; hole > 1 && x< array[ hole / 2 ]; hole /= 2 ) array[ hole ] = array[ hole / 2 ]; array[ hole ] = x; } /** * Find the smallest item in the priority queue. * return the smallest item, or null, if empty. */publicint findMin( ) {if( isEmpty( )...

1、当您付费下载文档后,您只拥有了使用权限,并不意味着购买了版权,文档只能用于自身使用,不得用于其他商业用途(如 [转卖]进行直接盈利或[编辑后售卖]进行间接盈利)。
2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。
3、如文档内容存在违规,或者侵犯商业秘密、侵犯著作权等,请点击“违规举报”。

碎片内容

确认删除?
VIP
微信客服
  • 扫码咨询
会员Q群
  • 会员专属群点击这里加入QQ群
客服邮箱
回到顶部