- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
* PassArray.html(1 of 3) The first call to function outputArray displays the contents of the Array a before it is modified. Function modifyArray multiplies each element by 2. * PassArray.html(2 of 3) Again, function outputArray is called to show that the contents of Array a have been modified. Method join takes as its argument a string containing a separator that should be used to separate the elements of the array in the string that is returned. Function modifyElement multiplies the contents of a[ 3 ] by 2. The value of a[ 3 ] is output to show its contents before it is modified. * PassArray.html(3 of 3) Multiply each element in theArray by 2. * 11.7 Passing Arrays to Functions Fig. 11.8 Passing arrays and individual array elements to functions. * 11.8 Sorting Arrays Sorting Important computing task Array.sort Defaults to string comparison Optional comparator function Return negative if first argument less than second Return zero if arguments equal Return positive if first argument greater than second * Sort.html(1 of 2) Method sort takes as its optional argument the name of a function that compares two arguments and returns a value of –1, 0 or 1. * Sort.html(2 of 2) Function compareIntegers calculates the difference between the integer values of its arguments. * 11.8 Sorting Arrays Fig. 11.9 Sorting an array with sort. * 11.9 Searching Arrays: Linear Search and Binary Search Searching Look for matching key value Linear search Iterate through each element until match found Inefficient Worst case scenario, must test entire array Binary search Requires sorted data Cuts search range in half each iteration Efficient Only look at small fraction of elements * LinearSearch.html(1 of 3) Array a is initiated with 100 elements. Array a is populated with the even integers 0 to 198. * LinearSearch.html(2 of 3) Get value of search key from the input field in the XHTML form. Calling function linearSearch and passing it the Array a and the value of variable searchKey
您可能关注的文档
- 【创新设和计】2013-2014学年高中语文粤教版选修《唐诗宋词元散曲选读》2-11咏物诗四首.ppt
- 【创新设和计】2013-2014学年高中语文粤教版选修《唐诗宋词元散曲选读》3-17爱国词四首.ppt
- 【创新设和计】2013届高中政治人教版必修二6-2.ppt
- 【导与练和】2013-2014学年高一政治(新人教版必修1):第三单元 收入与分配 单元综合.ppt
- 【广东】和2013版高中英语全程复习方略 素能提升演练(三十七)选修8 Unit 2(人教版).doc
- 【考前三和个月】2015届高考化学考前专题课件:专题3 学案8 化学反应速率 化学平衡.ppt
- 【名师解和读】初二物理平均速度的测量精品导学学案.doc
- 【全优设和计】2014年高一下学期化学必修2 同步测控课件:1-2-1 原子核外电子的排布.ppt
- 【全优设和计】2014年高一下学期化学必修2 同步测控课件:3-1-2 烷烃.ppt
- 【全优设和计】2014年高一下学期化学必修2 同步测控课件:4-1-1 开发利用金属矿物和海水资源.ppt
最近下载
- 四级检验工理论1.docx VIP
- 附件:江苏省建设工程监理现场用(第七版).docx VIP
- 钳工中级班练习(2021-10-27).docx VIP
- DB13_T1418-2011_高温闷棚土壤消毒技术规程_河北省.docx VIP
- 《牛的解剖》课件.ppt VIP
- 新收入准则下建筑业的全流程账务处理.pdf VIP
- DB11 971-2013 重点建设工程施工现场治安防范系统规范.pdf VIP
- 钳工中级班练习(2021-11-1).docx VIP
- 《医疗器械经营质量管理基本要求》DB14T 3291-2025.pdf VIP
- 2024年中考第三次模拟考试题:道德与法治(陕西卷)(解析版).docx VIP
原创力文档


文档评论(0)