Details

Essential Algorithms


Essential Algorithms

A Practical Approach to Computer Algorithms Using Python and C#
2. Aufl.

von: Rod Stephens

40,99 €

Verlag: Wiley
Format: EPUB
Veröffentl.: 15.05.2019
ISBN/EAN: 9781119575986
Sprache: englisch
Anzahl Seiten: 800

DRM-geschütztes eBook, Sie benötigen z.B. Adobe Digital Editions und eine Adobe ID zum Lesen.

Beschreibungen

<p><b>A friendly introduction to the most useful algorithms written in simple, intuitive English</b></p> <p>The revised and updated second edition of<i> Essential Algorithms, </i>offers an accessible introduction to computer algorithms. The book contains a description of important classical algorithms and explains when each is appropriate. The author shows how to analyze algorithms in order to understand their behavior and teaches techniques that the can be used to create new algorithms to meet future needs. The text includes useful algorithms such as: methods for manipulating common data structures, advanced data structures, network algorithms, and numerical algorithms. It also offers a variety of general problem-solving techniques.</p> <p>In addition to describing algorithms and approaches, the author offers details on how to analyze the performance of algorithms. The book is filled with exercises that can be used to explore ways to modify the algorithms in order to apply them to new situations. This updated edition of <i>Essential Algorithms</i>:</p> <ul> <li>Contains explanations of algorithms in simple terms, rather than complicated math</li> <li>Steps through powerful algorithms that can be used to solve difficult programming problems</li> <li>Helps prepare for programming job interviews that typically include algorithmic questions</li> <li>Offers methods can be applied to any programming language</li> <li>Includes exercises and solutions useful to both professionals and students</li> <li>Provides code examples updated and written in Python and C#</li> </ul> <p><i>Essential Algorithms</i> has been updated and revised and offers professionals and students a hands-on guide to analyzing algorithms as well as the techniques and applications. The book also includes a collection of questions that may appear in a job interview. The book’s website will include reference implementations in Python and C# (which can be easily applied to Java and C++).</p>
<p>Introduction xxix</p> <p><b>Chapter 1 Algorithm Basics 1</b></p> <p>Approach 2</p> <p>Algorithms and Data Structures 2</p> <p>Pseudocode 3</p> <p>Algorithm Features 6</p> <p>Big O Notation 7</p> <p>Rule 1 8</p> <p>Rule 2 8</p> <p>Rule 3 9</p> <p>Rule 4 9</p> <p>Rule 5 10</p> <p>Common Run Time Functions 11</p> <p>1 11</p> <p>Log N 11</p> <p>Sqrt N 14</p> <p>N 14</p> <p>N log N 15</p> <p>N<sup><i>2 </i></sup>15</p> <p>2<sup>N</sup> 15</p> <p>N! 16</p> <p>Visualizing Functions 16</p> <p>Practical Considerations 18</p> <p>Summary 19</p> <p>Exercises 20</p> <p><b>Chapter 2 Numerical Algorithms 23</b></p> <p>Randomizing Data 23</p> <p>Generating Random Values 23</p> <p>Generating Values 24</p> <p>Ensuring Fairness 26</p> <p>Getting Fairness from Biased Sources 28</p> <p>Randomizing Arrays 29</p> <p>Generating Nonuniform Distributions 30</p> <p>Making Random Walks 31</p> <p>Making Self-Avoiding Walks 33</p> <p>Making Complete Self-Avoiding Walks 34</p> <p>Finding Greatest Common Divisors 36</p> <p>Calculating Greatest Common Divisors 36</p> <p>Extending Greatest Common Divisors 38</p> <p>Performing Exponentiation 40</p> <p>Working with Prime Numbers 42</p> <p>Finding Prime Factors 42</p> <p>Finding Primes 44</p> <p>Testing for Primality 45</p> <p>Performing Numerical Integration 47</p> <p>The Rectangle Rule 48</p> <p>The Trapezoid Rule 49</p> <p>Adaptive Quadrature 50</p> <p>Monte Carlo Integration 54</p> <p>Finding Zeros 55</p> <p>Gaussian Elimination 57</p> <p>Forward Elimination 58</p> <p>Back Substitution 60</p> <p>The Algorithm 61</p> <p>Least Squares Fits 62</p> <p>Linear Least Squares 62</p> <p>Polynomial Least Squares 64</p> <p>Summary 67</p> <p>Exercises 68</p> <p><b>Chapter 3 Linked Lists 71</b></p> <p>Basic Concepts 71</p> <p>Singly Linked Lists 72</p> <p>Iterating Over the List 73</p> <p>Finding Cells 73</p> <p>Using Sentinels 74</p> <p>Adding Cells at the Beginning 75</p> <p>Adding Cells at the End 76</p> <p>Inserting Cells After Other Cells 77</p> <p>Deleting Cells 78</p> <p>Doubly Linked Lists 79</p> <p>Sorted Linked Lists 81</p> <p>Self-Organizing Linked Lists 82</p> <p>Move to Front (MTF) 83</p> <p>Swap 83</p> <p>Count 84</p> <p>Hybrid Methods 84</p> <p>Pseudocode 85</p> <p>Linked-List Algorithms 86</p> <p>Copying Lists 86</p> <p>Sorting with Insertionsort 87</p> <p>Sorting with Selectionsort 88</p> <p>Multithreaded Linked Lists 90</p> <p>Linked Lists with Loops 91</p> <p>Marking Cells 92</p> <p>Using Hash Tables 93</p> <p>List Retracing 94</p> <p>List Reversal 95</p> <p>Tortoise and Hare 98</p> <p>Loops in Doubly Linked Lists 100</p> <p>Summary 100</p> <p>Exercises 101</p> <p><b>Chapter 4 Arrays 103</b></p> <p>Basic Concepts 103</p> <p>One-Dimensional Arrays 106</p> <p>Finding Items 106</p> <p>Finding Minimum, Maximum, and Average 107</p> <p>Finding Median 108</p> <p>Finding Mode 109</p> <p>Inserting Items 112</p> <p>Removing Items 113</p> <p>Nonzero Lower Bounds 114</p> <p>Two Dimensions 114</p> <p>Higher Dimensions 115</p> <p>Triangular Arrays 118</p> <p>Sparse Arrays 121</p> <p>Find a Row or Column 123</p> <p>Get a Value 124</p> <p>Set a Value 125</p> <p>Delete a Value 127</p> <p>Matrices 129</p> <p>Summary 131</p> <p>Exercises 132</p> <p><b>Chapter 5 Stacks and Queues 135</b></p> <p>Stacks 135</p> <p>Linked-List Stacks 136</p> <p>Array Stacks 138</p> <p>Double Stacks 139</p> <p>Stack Algorithms 141</p> <p>Reversing an Array 141</p> <p>Train Sorting 142</p> <p>Tower of Hanoi 143</p> <p>Stack Insertionsort 145</p> <p>Stack Selectionsort 146</p> <p>Queues 147</p> <p>Linked-List Queues 148</p> <p>Array Queues 148</p> <p>Specialized Queues 151</p> <p>Priority Queues 151</p> <p>Deques 152</p> <p>Binomial Heaps 152</p> <p>Binomial Trees 152</p> <p>Binomial Heaps 154</p> <p>Merging Trees 155</p> <p>Merging Heaps 156</p> <p>Merging Tree Lists 156</p> <p>Merging Trees 158</p> <p>Enqueue 161</p> <p>Dequeue 162</p> <p>Runtime 163</p> <p>Summary 163</p> <p>Exercises 164</p> <p><b>Chapter 6 Sorting 167</b></p> <p>O(N<sup>2</sup> ) Algorithms 168</p> <p>Insertionsort in Arrays 168</p> <p>Selectionsort in Arrays 170</p> <p>Bubblesort 171</p> <p>O(NlogN) Algorithms 174</p> <p>Heapsort 175</p> <p>Storing Complete Binary Trees 175</p> <p>Defining Heaps 176</p> <p>Implementing Heapsort 180</p> <p>Quicksort 181</p> <p>Analyzing Quicksort’s Run Time 182</p> <p>Picking a Dividing Item 184</p> <p>Implementing Quicksort with Stacks 185</p> <p>Implementing Quicksort in Place 185</p> <p>Using Quicksort 188</p> <p>Mergesort 189</p> <p>Sub O(NlogN) Algorithms 192</p> <p>Countingsort 192</p> <p>Pigeonhole Sort 193</p> <p>Bucketsort 195</p> <p>Summary 197</p> <p>Exercises 198</p> <p><b>Chapter 7 Searching 201</b></p> <p>Linear Search 202</p> <p>Binary Search 203</p> <p>Interpolation Search 204</p> <p>Majority Voting 205</p> <p>Summary 207</p> <p>Exercises 208</p> <p><b>Chapter 8 Hash Tables 209</b></p> <p>Hash Table Fundamentals 210</p> <p>Chaining 211</p> <p>Open Addressing 213</p> <p>Removing Items 214</p> <p>Linear Probing 215</p> <p>Quadratic Probing 217</p> <p>Pseudorandom Probing 219</p> <p>Double Hashing 219</p> <p>Ordered Hashing 219</p> <p>Summary 222</p> <p>Exercises 222</p> <p><b>Chapter 9 Recursion 227</b></p> <p>Basic Algorithms 228</p> <p>Factorial 228</p> <p>Fibonacci Numbers 230</p> <p>Rod-Cutting 232</p> <p>Brute Force 233</p> <p>Recursion 233</p> <p>Tower of Hanoi 235</p> <p>Graphical Algorithms 238</p> <p>Koch Curves 239</p> <p>Hilbert Curve 241</p> <p>Sierpiński Curve 243</p> <p>Gaskets 246</p> <p>The Skyline Problem 247</p> <p>Lists 248</p> <p>Divide and Conquer 249</p> <p>Backtracking Algorithms 252</p> <p>Eight Queens Problem 254</p> <p>Knight’s Tour 257</p> <p>Selections and Permutations 260</p> <p>Selections with Loops 261</p> <p>Selections with Duplicates 262</p> <p>Selections without Duplicates 264</p> <p>Permutations with Duplicates 265</p> <p>Permutations without Duplicates 266</p> <p>Round-Robin Scheduling 267</p> <p>Odd Number of Teams 268</p> <p>Even Number of Teams 270</p> <p>Implementation 271</p> <p>Recursion Removal 273</p> <p>Tail Recursion Removal 274</p> <p>Dynamic Programming 275</p> <p>Bottom-Up Programming 277</p> <p>General Recursion Removal 277</p> <p>Summary 280</p> <p>Exercises 281</p> <p><b>Chapter 10 Trees 285</b></p> <p>Tree Terminology 285</p> <p>Binary Tree Properties 289</p> <p>Tree Representations 292</p> <p>Building Trees in General 292</p> <p>Building Complete Trees 295</p> <p>Tree Traversal 296</p> <p>Preorder Traversal 297</p> <p>Inorder Traversal 299</p> <p>Postorder Traversal 300</p> <p>Breadth-First Traversal 301</p> <p>Traversal Uses 302</p> <p>Traversal Run Times 303</p> <p>Sorted Trees 303</p> <p>Adding Nodes 303</p> <p>Finding Nodes 306</p> <p>Deleting Nodes 306</p> <p>Lowest Common Ancestors 309</p> <p>Sorted Trees 309</p> <p>Parent Pointers 310</p> <p>Parents and Depths 311</p> <p>General Trees 312</p> <p>Euler Tours 314</p> <p>All Pairs 316</p> <p>Threaded Trees 317</p> <p>Building Threaded Trees 318</p> <p>Using Threaded Trees 320</p> <p>Specialized Tree Algorithms 322</p> <p>The Animal Game 322</p> <p>Expression Evaluation 324</p> <p>Interval Trees 326</p> <p>Building the Tree 328</p> <p>Intersecting with Points 329</p> <p>Intersecting with Intervals 330</p> <p>Quadtrees 332</p> <p>Adding Items 335</p> <p>Finding Items 336</p> <p>Tries 337</p> <p>Adding Items 339</p> <p>Finding Items 341</p> <p>Summary 342</p> <p>Exercises 342</p> <p><b>Chapter 11 Balanced Trees 349</b></p> <p>AVL Trees 350</p> <p>Adding Values 350</p> <p>Deleting Values 353</p> <p>2-3 Trees 354</p> <p>Adding Values 355</p> <p>Deleting Values 356</p> <p>B-Trees 359</p> <p>Adding Values 360</p> <p>Deleting Values 361</p> <p>Balanced Tree Variations 362</p> <p>Top-down B-trees 363</p> <p>B+trees 363</p> <p>Summary 365</p> <p>Exercises 365</p> <p><b>Chapter 12 Decision Trees 367</b></p> <p>Searching Game Trees 368</p> <p>Minimax 369</p> <p>Initial Moves and Responses 373</p> <p>Game Tree Heuristics 374</p> <p>Searching General Decision Trees 375</p> <p>Optimization Problems 376</p> <p>Exhaustive Search 377</p> <p>Branch and Bound 379</p> <p>Decision Tree Heuristics 381</p> <p>Random Search 381</p> <p>Improving Paths 382</p> <p>Simulated Annealing 384</p> <p>Hill Climbing 385</p> <p>Sorted Hill Climbing 386</p> <p>Other Decision Tree Problems 387</p> <p>Generalized Partition Problem 387</p> <p>Subset Sum 388</p> <p>Bin Packing 388</p> <p>Cutting Stock 389</p> <p>Knapsack 390</p> <p>Traveling Salesman Problem 391</p> <p>Satisfiability 391</p> <p>Swarm Intelligence 392</p> <p>Ant Colony Optimization 393</p> <p>General Optimization 393</p> <p>Traveling Salesman 393</p> <p>Bees Algorithm 394</p> <p>Swarm Simulation 394</p> <p>Boids 395</p> <p>Pseudoclassical Mechanics 396</p> <p>Goals and Obstacles 397</p> <p>Summary 397</p> <p>Exercises 398</p> <p><b>Chapter 13 Basic Network Algorithms 403</b></p> <p>Network Terminology 403</p> <p>Network Representations 407</p> <p>Traversals 409</p> <p>Depth-First Traversal 410</p> <p>Breadth-First Traversal 412</p> <p>Connectivity Testing 413</p> <p>Spanning Trees 416</p> <p>Minimal Spanning Trees 417</p> <p>Euclidean Minimum Spanning Trees 418</p> <p>Building Mazes 419</p> <p>Strongly Connected Components 420</p> <p>Kosaraju’s Algorithm 421</p> <p>Algorithm Discussion 422</p> <p>Finding Paths 425</p> <p>Finding Any Path 425</p> <p>Label-Setting Shortest Paths 426</p> <p>Label-Correcting Shortest Paths 430</p> <p>All-Pairs Shortest Paths 431</p> <p>Transitivity 436</p> <p>Transitive Closure 437</p> <p>Transitive Reduction 438</p> <p>Acyclic Networks 439</p> <p>General Networks 440</p> <p>Shortest Path Modifications 441</p> <p>Shape Points 441</p> <p>Early Stopping 442</p> <p>Bidirectional Search 442</p> <p>Best-First Search 442</p> <p>Turn Penalties and Prohibitions 443</p> <p>Geometric Calculations 443</p> <p>Expanded Node Networks 444</p> <p>Interchange Networks 445</p> <p>Summary 447</p> <p>Exercises 447</p> <p><b>Chapter 14 More Network Algorithms 451</b></p> <p>Topological Sorting 451</p> <p>Cycle Detection 455</p> <p>Map Coloring 456</p> <p>Two-Coloring 456</p> <p>Three-Coloring 458</p> <p>Four-Coloring 459</p> <p>Five-Coloring 459</p> <p>Other Map-Coloring Algorithms 462</p> <p>Maximal Flow 464</p> <p>Work Assignment 467</p> <p>Minimal Flow Cut 468</p> <p>Network Cloning 470</p> <p>Dictionaries 471</p> <p>Clone References 472</p> <p>Cliques 473</p> <p>Brute Force 474</p> <p>Bron–Kerbosch 475</p> <p>Sets R, P, and X 475</p> <p>Recursive Calls 476</p> <p>Pseudocode 476</p> <p>Example 477</p> <p>Variations 480</p> <p>Finding Triangles 480</p> <p>Brute Force 481</p> <p>Checking Local Links 481</p> <p>Chiba and Nishizeki 482</p> <p>Community Detection 483</p> <p>Maximal Cliques 483</p> <p>Girvan–Newman 483</p> <p>Clique Percolation 485</p> <p>Eulerian Paths and Cycles 485</p> <p>Brute Force 486</p> <p>Fleury’s Algorithm 486</p> <p>Hierholzer’s Algorithm 487</p> <p>Summary 488</p> <p>Exercises 489</p> <p><b>Chapter 15 String Algorithms 493</b></p> <p>Matching Parentheses 494</p> <p>Evaluating Arithmetic Expressions 495</p> <p>Building Parse Trees 496</p> <p>Pattern Matching 497</p> <p>DFAs 497</p> <p>Building DFAs for Regular Expressions 500</p> <p>NFAs 502</p> <p>String Searching 504</p> <p>Calculating Edit Distance 508</p> <p>Phonetic Algorithms 511</p> <p>Soundex 511</p> <p>Metaphone 513</p> <p>Summary 514</p> <p>Exercises 515</p> <p><b>Chapter 16 Cryptography 519</b></p> <p>Terminology 520</p> <p>Transposition Ciphers 521</p> <p>Row/Column Transposition 521</p> <p>Column Transposition 523</p> <p>Route Ciphers 525</p> <p>Substitution Ciphers 526</p> <p>Caesar Substitution 526</p> <p>Vigenere Cipher 527</p> <p>Simple Substitution 529</p> <p>One-Time Pads 530</p> <p>Block Ciphers 531</p> <p>Substitution-Permutation Networks 531</p> <p>Feistel Ciphers 533</p> <p>Public-Key Encryption and RSA 534</p> <p>Euler’s Totient Function 535</p> <p>Multiplicative Inverses 536</p> <p>An RSA Example 536</p> <p>Practical Considerations 537</p> <p>Other Uses for Cryptography 538</p> <p>Summary 539</p> <p>Exercises 540</p> <p><b>Chapter 17 Complexity Theory 543</b></p> <p>Notation 544</p> <p>Complexity Classes 545</p> <p>Reductions 548</p> <p>3SAT 549</p> <p>Bipartite Matching 550</p> <p>NP-Hardness 550</p> <p>Detection, Reporting, and Optimization Problems 551</p> <p>Detection ≤<sub>p</sub> Reporting 552</p> <p>Reporting ≤<sub>p</sub> Optimization 552</p> <p>Reporting ≤<sub>p</sub> Detection 552</p> <p>Optimization ≤<sub>p</sub> Reporting 553</p> <p>Approximate Optimization 553</p> <p>NP-Complete Problems 554</p> <p>Summary 557</p> <p>Exercises 558</p> <p><b>Chapter 18 Distributed Algorithms 561</b></p> <p>Types of Parallelism 562</p> <p>Systolic Arrays 562</p> <p>Distributed Computing 565</p> <p>Multi-CPU Processing 567</p> <p>Race Conditions 567</p> <p>Deadlock 571</p> <p>Quantum Computing 572</p> <p>Distributed Algorithms 573</p> <p>Debugging Distributed Algorithms 573</p> <p>Embarrassingly Parallel Algorithms 574</p> <p>Mergesort 576</p> <p>Dining Philosophers 577</p> <p>Randomization 578</p> <p>Resource Hierarchy 578</p> <p>Waiter 579</p> <p>Chandy/Misra 579</p> <p>The Two Generals Problem 580</p> <p>Byzantine Generals 581</p> <p>Consensus 584</p> <p>Leader Election 587</p> <p>Snapshot 588</p> <p>Clock Synchronization 589</p> <p>Summary 591</p> <p>Exercises 591</p> <p><b>Chapter 19 Interview Puzzles 595</b></p> <p>Asking Interview Puzzle Questions 597</p> <p>Answering Interview Puzzle Questions 598</p> <p>Summary 602</p> <p>Exercises 604</p> <p><b>Appendix A Summary of Algorithmic Concepts 607</b></p> <p>Chapter 1: Algorithm Basics 607</p> <p>Chapter 2: Numeric Algorithms 608</p> <p>Chapter 3: Linked Lists 609</p> <p>Chapter 4: Arrays 610</p> <p>Chapter 5: Stacks and Queues 610</p> <p>Chapter 6: Sorting 610</p> <p>Chapter 7: Searching 611</p> <p>Chapter 8: Hash Tables 612</p> <p>Chapter 9: Recursion 612</p> <p>Chapter 10: Trees 614</p> <p>Chapter 11: Balanced Trees 615</p> <p>Chapter 12: Decision Trees 615</p> <p>Chapter 13: Basic Network Algorithms 616</p> <p>Chapter 14: More Network Algorithms 617</p> <p>Chapter 15: String Algorithms 618</p> <p>Chapter 16: Cryptography 618</p> <p>Chapter 17: Complexity Theory 619</p> <p>Chapter 18: Distributed Algorithms 620</p> <p>Chapter 19: Interview Puzzles 621</p> <p><b>Appendix B Solutions to Exercises 623</b></p> <p>Chapter 1: Algorithm Basics 623</p> <p>Chapter 2: Numerical Algorithms 626</p> <p>Chapter 3: Linked Lists 633</p> <p>Chapter 4: Arrays 638</p> <p>Chapter 5: Stacks and Queues 648</p> <p>Chapter 6: Sorting 650</p> <p>Chapter 7: Searching 653</p> <p>Chapter 8: Hash Tables 655</p> <p>Chapter 9: Recursion 658</p> <p>Chapter 10: Trees 663</p> <p>Chapter 11: Balanced Trees 670</p> <p>Chapter 12: Decision Trees 675</p> <p>Chapter 13: Basic Network Algorithms 678</p> <p>Chapter 14: More Network Algorithms 681</p> <p>Chapter 15: String Algorithms 686</p> <p>Chapter 16: Encryption 689</p> <p>Chapter 17: Complexity Theory 692</p> <p>Chapter 18: Distributed Algorithms 697</p> <p>Chapter 19: Interview Puzzles 701</p> <p>Glossary 711</p> <p>Index 739</p>
<p><b>Rod Stephens</b> began his career as a mathematician, but while at MIT he was lured into the intriguing world of algorithms and has been programming ever since. An award-winning instructor, he regularly addresses conferences and has written more than 30 books that have been translated into nearly a dozen languages.
<p><b>Master the most useful algorithms and build your problem-solving skills</b> <p>Algorithms are the recipes that make efficient programming possible. Studying them lets you build a useful toolkit of methods for solving specific problems. Using Python and C#, this book introduces you to many classic algorithms, shows you where they work, and explains how to analyze them to understand their behavior. The study of algorithms also teaches general problem-solving techniques that make you a better programmer. You might find that this book not only helps you on the job, it may help you get the job. <p><b>Learn useful algorithms including</b> <ul> <li>Numerical algorithms: randomization, factoring, prime numbers, and numeric integration</li> <li>Methods for manipulating common data structures: arrays, linked lists, and networks</li> <li>More advanced data structures: heaps, trees, balanced trees, and B-trees</li> </ul> <p><b>Learn these and other problem-solving techniques:</b> <ul> <li>Brute force or exhaustive search</li> <li>Divide and conquer</li> <li>Greedy algorithms and hill climbing</li> <li>Least cost algorithms</li> <li>Heuristics</li> <li>Constricting bounds</li> </ul>

Diese Produkte könnten Sie auch interessieren:

Domain Architectures
Domain Architectures
von: Daniel J. Duffy
PDF ebook
31,99 €