Cover image for Logical problem solving : before the flowchart, with C++ and visual basic applications
Title:
Logical problem solving : before the flowchart, with C++ and visual basic applications
Personal Author:
Publication Information:
Upper Saddle River, NJ : Prentice Hall, 2002
Physical Description:
xvi, 391 p. : ill. ; 24 cm.
ISBN:
9780130618825

Available:*

Library
Item Barcode
Call Number
Material Type
Item Category 1
Status
Searching...
30000010183995 QA76.73.C153 L34 2002 Open Access Book Book
Searching...

On Order

Summary

Summary

This book shows readers how to best attack a wide variety of problems that they may not have previously solved. It focuses on techniques for developing the logic required to solve problems and how that logic is translated into writing effective computer programs. The author uses a consistent structure throughout the book of introducing a problem and formulating the solution based on a set of rules for creative problem solving. The solution is then represented first in pseudocode, then in a flowchart, then in C++ and finally in Visual Basic. This approach provides readers with a strong foundation in problem solving that will benefit them in areas beyond programming.


Table of Contents

Prefacep. ix
1 Understanding the Problemp. 1
1.1 In the Beginningp. 1
Rule 1 The Clarity Rulep. 1
Problem 1.1 If a man is 6'1.5" tall, what is his height in centimeters?p. 2
1.2 Including Common Informationp. 5
Problem 1.2 How much does 50 gallons of water weigh?p. 5
Rule 2 The Units Rulep. 6
1.3 Including Uncommon Informationp. 10
Problem 1.3 What Celsius temperature is equivalent to a given Fahrenheit temperature?p. 10
Problem 1.3a What is the relationship between the Celsius and Fahrenheit scales?p. 10
Problem 1.4 What is the area of a user-defined trapezoid?p. 14
Rule 3 The Picture Rulep. 14
Problem 1.5 Calculate the pull of gravity on an astronaut aboard the space shuttlep. 18
1.4 Working Backwardp. 22
Rule 4 The Working Backward Rulep. 23
Problem 1.6 Calculate the number of molecules in a certain amount of chemical compoundp. 23
1.5 Working Backward-A Ball Is Dropped from a Tall Buildingp. 27
Problem 1.7 If a ball is dropped from a tall building, how far does it travel in the first second, the second second, the third second, and the fourth second?p. 28
2 Repetitionp. 33
2.1 The Power of the Personal Computerp. 33
Rule 5 The Repetition Rulep. 33
2.2 The Falling Ballp. 34
Problem 2.1 If a ball is dropped from a sufficient height, how far does it travel each second and what is its speed at the end of each second for the first 20 seconds?p. 34
Rule 6 The Clarity in Loops Rulep. 34
Rule 7 The Limit of the Problem Rulep. 38
2.3 The Penny Problemp. 41
Problem 2.2 What is the value, mass, and volume of a stack of pennies?p. 41
2.4 Grade Point Averagep. 50
Problem 2.3 What is the grade point average for a given set of grades?p. 50
2.5 Binary Conversionp. 57
Problem 2.4 How can an arbitrary positive integer be converted from decimal (base 10) to binary (base 2)?p. 58
Rule 8 The Concrete Example Rulep. 58
2.6 Daily Compounded Interestp. 65
Problem 2.5 Determine the value of a savings accountp. 65
2.7 The Wall Problemp. 72
Problem 2.6 Is it possible to walk to a wall?p. 73
Rule 9 The Successive Approximation Rulep. 73
2.8 Superflyp. 77
Problem 2.7 How long was Superfly's last flight?p. 77
2.9 MacLaurin Series Expansionp. 85
Problem 2.8 Calculate the value of the sine function for an arbitrary anglep. 86
3 Zeroing in on Solutionsp. 92
3.1 Strategic Guessingp. 92
3.2 Calculating Square Rootsp. 93
Rule 10 Strategic Guessing Rulep. 93
Problem 3.1 Find the square root of a number greater than onep. 94
3.3 Improved Strategic Guessing--Newton-Raphson Methodp. 99
Problem 3.2 Find the square root of a positive number using the Newton-Raphson Methodp. 101
3.4 The Ladder Problemp. 105
Problem 3.3 The ladder problem involves two ladders in an alleyp. 106
3.5 The Unsolvable Equationp. 114
Problem 3.4 How can you find the solutions to a fifth-order equation?p. 115
Rule 11 The Functions Rulep. 117
4 Brute Forcep. 125
4.1 Nonstrategic Guessingp. 125
Rule 12 The Brute Force Rulep. 125
4.2 The Liars Problemp. 125
Problem 4.1 The Liars Problemp. 126
Rule 13 The Self-Consistency Rulep. 126
4.3 The Comedians' Hatsp. 128
Problem 4.2 The Comedian's Hats Problemp. 128
4.4 Prime Numbersp. 130
Problem 4.3 Determine whether a number less than four billion is prime and, if not, what are the prime factorsp. 130
4.5 Searching Routinesp. 137
Problem 4.4 Divide a sentence provided by the user into its component wordsp. 137
Problem 4.5 What are the most commonly used letters in the English language?p. 143
4.6 Sorting Routinesp. 150
Problem 4.6 How can a list of 20 numbers be sorted?p. 150
Problem 4.7 Sort a list of 20 students by their grades using a bubble sort routinep. 158
4.7 Combining Searching and Sortingp. 165
Problem 4.8 Create an index for text entered by the userp. 165
5 Look-Up Tablesp. 174
5.1 The Look-Up Tablep. 174
Problem 5.1 Encode and decode a message with an unbreakable codep. 174
5.2 The Understood Look-Up Tablep. 188
Problem 5.2 How can 50-digit positive numbers be added together?p. 188
5.3 The Unsolvable Problemp. 199
Problem 5.3 The Traveling Salesman Problemp. 199
6 Simulationsp. 212
6.1 Probabilitiesp. 212
6.2 Calculating the Oddsp. 212
Problem 6.1 The Coin Flip Problemp. 212
Rule 14 The Probability Rulep. 213
Problem 6.2 What are the odds of winning a game of craps on the first roll?p. 218
Problem 6.3 The Monopoly Problemp. 225
6.3 The "What If" Scenariop. 232
Problem 6.4 The Perfect Shuffle Problemp. 233
6.4 Geometric Probabilityp. 242
Problem 6.5 Buffon's Needlep. 243
6.5 Integral Calculusp. 249
Problem 6.6 The Basketball Court Problemp. 249
Rule 15 The Approximation Rulep. 251
7 Removing the Limitsp. 259
7.1 Limitations in Accuracyp. 259
7.2 Limitations in Scopep. 260
Problem 7.1 Find the square root of any rational numberp. 260
Rule 16 The Expansion Rulep. 260
Problem 7.2 Convert any rational decimal number into binaryp. 265
7.3 Limitations in Conditionsp. 270
Problem 7.3 Craps Problem Expandedp. 270
7.4 Elimination of the Random Number Biasp. 275
7.5 Limitations in Optionsp. 276
Problem 7.4 Binary Conversion Second Expansionp. 277
7.6 Limitations in Utilityp. 285
Problem 7.5 Encryption Problem Expandedp. 286
Problem 7.6 Letter Frequency Problem Expandedp. 297
Problem 7.7 Letter Frequency Problem with Sortingp. 302
Problem 7.8 Satellite Orbit Problemp. 308
Problem 7.9 Geosynchronous Orbit Problemp. 315
8 Advanced Techniquesp. 321
8.1 Error Trappingp. 321
Problem 8.1 The Reciprocal Problemp. 322
8.2 Handling Inputp. 325
Problem 8.2 The Floating-point Input Problemp. 326
8.3 The Advantages of Objectsp. 332
Problem 8.3 The Money Problemp. 333
Problem 8.4 The Word Count and Sort Problemp. 338
8.4 Recursionp. 350
Problem 8.5 Generating Factorialsp. 350
Rule 17 The Recursion Rulep. 350
Problem 8.6 Tower of Hanoip. 355
Problem 8.7 The Traveling Salesman Revisitedp. 361
9 Epilogp. 375
9.1 Rule Zerop. 375
Appendix Ap. 377
Appendix Bp. 379
Appendix Cp. 381
Appendix Dp. 383
Appendix Ep. 385
Indexp. 386