Data Structures and Other Objects Using C++ 4th Edition Solution Manual

Need to ace your assignments? Use Data Structures and Other Objects Using C++ 4th Edition Solution Manual for detailed, easy-to-understand solutions to textbook questions.

Olivia Parker
Contributor
4.9
59
7 months ago
Preview (8 of 26 Pages)
100%
Purchase to unlock

Page 1

Data Structures and Other Objects Using C++ 4th Edition Solution Manual - Page 1 preview image

Loading page ...

Chapter1:SolutionstoSampleExamQuestionsShortAnswerQuestions1.1.Useaprecondition/postconditioncontract.Forexample:doublenew_balance(doublebalance,doubleinterest_rate);//Precondition:Theparameterinterest_rateistheannualbank//accountinterestrate,forexample5.0for5%.Theparameter//balanceisanaccountbalancebeforeinterestisposted.//Postcondition:Thevaluereturnedbythefunctionisthenew//accountbalanceafterpostingoneyearofsimpleinterestat//therategivenbyinterest_rate.1.2.Apreconditionisastatementgivingtheconditionthatissupposedtobetruewhenafunctioniscalled.Apostconditionisastatementdescribingwhatwillbetruewhenafunctioncalliscompleted.1.3.Ifthepreconditionfails,thefunctioncanprintanerrormessageandhalttheprogram.1.4.Preconditionscannotalwaysbechecked.1.5.Ifyoucallafunctionandthepreconditionisfalse,thenthereisnotellingwhatmighthappen.Anythingcouldhappen,includingerasingtheentireharddrive.Ofcourse,thefunctionsthatwewritetrytoavoidsuchunpleasantbehavior,butthereisnoguarantee.1.6.voidexam(inti)//Precondition:iisnotequalto42.//Libraryfacilitiesused:assert.h{assert(i!=42);...1.7.lognistheapproximatenumberofdigitsinn(usingbase10logs).(Theexactformulaisfloor(logn)+1,usingbase10logsandthefloorfunctionwhichroundsarealnumberdowntothenextlowestinteger.)1.8.Evenaslowprocessorwillbeatafastprocessoriftheslowerprocessorusesafasteralgorithmandtheinputsizeislargeenough.1.9.ThefirstformulaisO(n).ThesecondandfourthformulasareO(n^2)(using^forexponentiation).ThethirdformulaisO(logn).1.10.SeetheMethod2analysisonpage17ofthetext.1.11.Mydebuggerletsmerunaprogramandstopitataspecifiedpointtoexaminethecurrentvaluesofvariables.Afterthis,Icanstepthroughtheprogramonelineatatime,continuingtokeepawatchonvariablevalues.OrIcancontinueexecutioninanormalway,specifyingalaterpointtostoptheprogram.MultipleChoiceQuestions:

Page 2

Page 3

Page 4

Page 5

Page 6

Page 7

Page 8

Preview Mode

This document has 26 pages. Sign in to access the full document!

Study Now!

XY-Copilot AI
Unlimited Access
Secure Payment
Instant Access
24/7 Support
Document Chat

Related Documents

View all