Data Structures with C++ using STL 2E Chapter 3

Data Structures with C++ using STL 2E Chapter 3

ID:44251815

大小:398.50 KB

页数:49页

时间:2019-10-20

Data Structures with C++ using STL 2E Chapter 3_第1页
Data Structures with C++ using STL 2E Chapter 3_第2页
Data Structures with C++ using STL 2E Chapter 3_第3页
Data Structures with C++ using STL 2E Chapter 3_第4页
Data Structures with C++ using STL 2E Chapter 3_第5页
资源描述:

《Data Structures with C++ using STL 2E Chapter 3》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库

1、1MainIndexContentsSelectionSort(3slides)SelectionSortAlg.(3slides)SearchAlgorithms(6slides)IllustratingtheBinarySearch-Successful(3slides)-Unsuccessful(3slides)BinarySearchAlg.(3slides)Big-ONotationConstantTimeAlgorithmsLinearTimeAlgorithmsExponentialAlgs.(2slides)LogarithmicTimeAlgorithm

2、sChapter3–IntroductiontoAlgorithmsSelectionSortAlgorithm-IntegerVersion-StringVersionTemplateSyntax(4slides)RecursiveDefnofthePowerFncStoppingConditionsfor-RecursiveAlgorithmsImplementingtheRecursive-PowerFunctionTowerofHanoiw/Recursion(3slides)FibonacciNumbersUsing-Iteration(2slides)Summ

3、arySlides(5slides)12MainIndexContentsSelectionSort -5ElementArrayPass0:Scantheentirelistfromarr[0]toarr[4]andidentify20atindex1asthesmallestelement.Exchange20witharr[0]=50,thefirstelementinthelist.23MainIndexContentsSelectionSort -5ElementArrayPass1:Scanthesublist50,40,75,and35.Exchangeth

4、esmallestelement35atindex4witharr[1]=50.34MainIndexContentsSelectionSort -5ElementArrayPass2:Locatethesmallestelementinthesublist40,75,and50.45MainIndexContentsSelectionSort -5ElementArrayPass3:Twoelementsremaintobesorted.Scanthesublist75,50andexchangethesmallerelementwitharr[3].Theexchan

5、geplaces50atindex4inarr[3].56MainIndexContentsSelectionSort -5ElementArray67MainIndexContentsSelectionSortAlgorithmvoidselectionSort(intarr[],intn){intsmallIndex;//indexofsmallest//elementinthesublistintpass,j;inttemp;//passhastherange0ton-278MainIndexContentsSelectionSortAlgorithmfor(pas

6、s=0;pass

7、xandpassarenotthe//samelocation,exchangethe//smallestiteminthesublistwith//arr[pass]if(smallIndex!=pass){temp=arr[pass];arr[pass]=arr[smallIndex];arr[smallIndex]=temp;}}}9SearchAlgorithmsSearchalgorithmsstartwithatargetvalueandemploysomestrategytovisittheelementsloo

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。