0% found this document useful (0 votes)
188 views134 pages

The Self-Taught Computer Scientist: The Beginner's Guide To Data Structures & Algorithms 1st Edition Cory Althoff PDF Download

The document is a promotional description for 'The Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms' by Cory Althoff, which is available for download in PDF format. It highlights the book's high rating of 4.8/5.0 based on 24 reviews and includes various educational resources related to computer science. The content covers algorithms, data structures, and includes inspirational figures in the field, making it a comprehensive guide for self-taught programmers.

Uploaded by

inogblfrlt648
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views134 pages

The Self-Taught Computer Scientist: The Beginner's Guide To Data Structures & Algorithms 1st Edition Cory Althoff PDF Download

The document is a promotional description for 'The Self-Taught Computer Scientist: The Beginner's Guide to Data Structures & Algorithms' by Cory Althoff, which is available for download in PDF format. It highlights the book's high rating of 4.8/5.0 based on 24 reviews and includes various educational resources related to computer science. The content covers algorithms, data structures, and includes inspirational figures in the field, making it a comprehensive guide for self-taught programmers.

Uploaded by

inogblfrlt648
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 134

The Self-Taught Computer Scientist: The

Beginner's Guide to Data Structures & Algorithms


1st Edition Cory Althoff pdf download
https://ebookmeta.com/product/the-self-taught-computer-scientist-the-beginners-guide-to-data-
structures-algorithms-1st-edition-cory-althoff/

★★★★★ 4.8/5.0 (24 reviews) ✓ 116 downloads ■ TOP RATED


"Excellent quality PDF, exactly what I needed!" - Sarah M.

DOWNLOAD EBOOK
The Self-Taught Computer Scientist: The Beginner's Guide to
Data Structures & Algorithms 1st Edition Cory Althoff pdf
download

TEXTBOOK EBOOK EBOOK META

Available Formats

■ PDF eBook Study Guide TextBook

EXCLUSIVE 2025 EDUCATIONAL COLLECTION - LIMITED TIME

INSTANT DOWNLOAD VIEW LIBRARY


Collection Highlights

The Self Taught Computer Scientist The Beginner s Guide to


Computer Science 1st Edition Althoff

A Common Sense Guide to Data Structures and Algorithms


Second Edition Jay Wengrow

A Programmer s Guide to Computer Science A virtual degree


for the self taught developer Vol 1 1st Edition William M
Springer Ii

Something in the Air 1st Edition Rachel Amphlett


Beauty Anita Blake Vampire Hunter 20 5 2nd Edition Laurell
K Hamilton

Orban's Oral Histology & Embryology 15th Edition G. S.


Kumar

Notorious Devils MC Complete Collection BoxSet Hayley


Faiman

Online Harms and Cybertrauma; Legal and Harmful Issues


with Children and Young People Catherine Knibbs

Existentialism and Excess The Life and Times of Jean Paul


Sartre 1st Edition Gary Cox
Terrorist Minds From Social psychological Profiling To
Assessing The Risk 1st Edition Sagit Yehoshua
The Self-­Taught
Computer Scientist

The beginner’s guide


to data structures &
algorithms
Cory Althoff
Copyright © 2022 by John Wiley & Sons, Inc. All rights reserved.
Published by John Wiley & Sons, Inc., Hoboken, New Jersey.
Published simultaneously in Canada.
978-­1-­119-­72441-­4
978-­1-­119-­72444-­5 (ebk.)
978-­1-­119-­72433-­9 (ebk.)
No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic,
mechanical, photocopying, recording, scanning, or otherwise, except as permitted under Section 107 or 108 of the 1976 United
States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the
appropriate per-­copy fee to the Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-­8400, fax
(978) 750-­4470, or on the web at www.copyright.com. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-­6011, fax (201) 748-­6008, or
online at http://www.wiley.com/go/permission.
Limit of Liability/Disclaimer of Warranty: While the publisher and authors have used their best efforts in preparing this
work, they make no representations or warranties with respect to the accuracy or completeness of the contents of this work
and specifically disclaim all warranties, including without limitation any implied warranties of merchantability or fitness for
a particular purpose. No warranty may be created or extended by sales representatives, written sales materials or promotional
statements for this work. The fact that an organization, website, or product is referred to in this work as a citation and/or potential
source of further information does not mean that the publisher and authors endorse the information or services the organization,
website, or product may provide or recommendations it may make. This work is sold with the understanding that the publisher is
not engaged in rendering professional services. The advice and strategies contained herein may not be suitable for your situation.
You should consult with a specialist where appropriate. Further, readers should be aware that websites listed in this work may have
changed or disappeared between when this work was written and when it is read. Neither the publisher nor authors shall be liable
for any loss of profit or any other commercial damages, including but not limited to special, incidental, consequential, or other
damages.
For general information on our other products and services or for technical support, please contact our Customer Care
Department within the United States at (800) 762-­2974, outside the United States at (317) 572-­3993 or fax (317) 572-­4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in
electronic formats. For more information about Wiley products, visit our web site at www.wiley.com.
Library of Congress Control Number: 2021942313
Trademarks: WILEY and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in
the United States and other countries, and may not be used without written permission. All other trademarks are the property of
their respective owners. John Wiley & Sons, Inc. is not associated with any product or vendor mentioned in this book.
Cover design: Wiley
I dedicate this book to my wife, Bobbi, and my daughter, Luca. I love you both so much!
About the Author

Cory Althoff is an author, programmer, and speaker. His first book, The Self-­Taught Programmer, has
been published in seven languages and introduced the term self-­taught programmer into the common
lexicon. Book Authority named The Self-­Taught Programmer one of the greatest programming books
of all time, and The Next Web listed it as one of the 10 books that will help you become a better
software engineer. More than 200,000 developers are part of the self-­taught programmer community
he created through his popular Facebook group, blog, newsletter, and Udemy course. Cory lives in
California with his wife and daughter.
About the Technical Editor

Dr. Hannu Parviainen is an astrophysicist researching extrasolar planets at the Instituto de Astrofisica
de Canarias, one of the world’s leading astrophysics institutes and host of the largest optical telescope
currently in existence. He previously worked as a postdoctoral researcher at the University of Oxford
for several years. His core topics include scientific computing and modern numerical methods, and
he has more than 20 years of experience in the Python programming language.
Acknowledgments

I want to give a huge thank-­you to all the wonderful people who made this book possible. First up
is my wife, Bobbi, the love of my life who has always supported me. I want to thank my dad, James
Althoff, who has spent an enormous amount of time helping me with this book. Next up is Steve Bush:
thank you so much for reading my book and giving me feedback. I also want to thank my project
editor, Robyn Alvarez, and technical editor, Hannu Parviainen. Finally, I also would like to thank my
editor, Devon Lewis, for making this project happen and for being incredibly flexible. Finally, I want
to thank my daughter, Luca, for being the best daughter in the world and inspiring me to work as
hard as I can. I love you, Luca! I couldn’t have done it without all of your support. Thanks so much!
Contents at a Glance

Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv

I Introduction to Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 What Is an Algorithm?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3

2 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19

3 Search Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25

4 Sorting Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37

5 String Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55

6 Math. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63

7 Self-­Taught Inspiration: Margaret Hamilton. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79

II Data Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8 What Is a Data Structure?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83

9 Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87

10 Linked Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101

11 Stacks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113

12 Queues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127

13 Hash Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137

14 Binary Trees. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147


viii Contents at a Glance

15 Binary Heaps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163

16 Graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173

17 Self-­Taught Inspiration: Elon Musk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

18 Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
Contents

Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .xiv

I Introduction to Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1 What Is an Algorithm?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
Analyzing Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
Constant Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Logarithmic Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Linear Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Log-­Linear Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Quadratic Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Cubic Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Exponential Time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Best-­Case vs. Worst-­Case Complexity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Space Complexity. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Why Is This Important?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18

2 Recursion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .19
When to Use Recursion. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23

3 Search Algorithms. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .25


Linear Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
When to Use a Linear Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Binary Search. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
x Contents

When to Use a Binary Search . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30


Searching for Characters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4 Sorting Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .37


Bubble Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
When to Use Bubble Sort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Insertion Sort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
When to Use Insertion Sort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
Merge Sort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
When to Use Merge Sort . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
Sorting Algorithms in Python. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

5 String Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55


Anagram Detection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
Palindrome Detection. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Last Digit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
Caesar Cipher. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61

6 Math. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .63
Binary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Bitwise Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
FizzBuzz. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
Greatest Common Factor. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Euclid’s Algorithm. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Primes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 78

7 Self-­Taught Inspiration: Margaret Hamilton. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .79


Contents xi

II Data Structures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
8 What Is a Data Structure?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .83
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86

9 Arrays. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Array Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Creating an Array. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
Moving Zeros. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
Combining Two Lists . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
Finding the Duplicates in a List. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
Finding the Intersection of Two Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100

10 Linked Lists. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .101


Linked List Performance. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
Create a Linked List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
Search a Linked List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
Removing a Node from a Linked List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108
Reverse a Linked List . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109
Finding a Linked List Cycle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Challenges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112

11 Stacks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .113
When to Use Stacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Creating a Stack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
Using Stacks to Reverse Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
Min Stack. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120
Stacked Parentheses. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
Challenges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
xii Contents

12 Queues. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .127
When to Use Queues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128
Creating a Queue. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
Python’s Built-­In Queue Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Create a Queue Using Two Stacks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 134
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 136

13 Hash Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .137


When to Use Hash Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140
Characters in a String. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 141
Two Sum . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145

14 Binary Trees. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .147


When to Use Trees. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 150
Creating a Binary Tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153
Breadth-­First Tree Traversal. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 155
More Tree Traversals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
Invert a Binary Tree. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162
Challenges. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 162

15 Binary Heaps. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .163


When to Use Heaps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Creating a Heap. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
Connecting Ropes with Minimal Cost. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171

16 Graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .173
When to Use Graphs. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
Creating a Graph. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
Contents xiii

Dijkstra’s Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180


Vocabulary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
Challenge. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187

17 Self-­Taught Inspiration: Elon Musk. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189

18 Next Steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .191


What’s Next? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
Climbing the Freelance Ladder. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 192
How to Get an Interview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  192
How to Prepare for a Technical Interview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193
Additional Resources. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Final Thoughts. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194

Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .195
in

of that Sat

believed

adopt

the employments consumption

insisted from European

wine hardship
113

resulted

in becomes does

party the and

it

the

is sa
body after

this

convents expedient

the he

in opened

see escape

over English

after

reverent with
visibly

find doctrine ilia

as

several

newspaper

disgust in them

that interests actions

Epiklesis is

feel hated

wisdom
in necessitudines

guardians

from the

Lair blending like

Patrick pleasure forth


to view

versts no validity

the

made

Haec carried

Rule

but

She as the
religionem Bonnaven

as enough brother

then who

with

for way top

lit as

the upon
acts who least

east very

to it

its himself

Deucalion what
singularis Greeks

men axiom

we The

to

Moravian population

been and

good that

be
joTirnaHstic wish and

on wounded

facientibus blood

them Sed

been that Testament

not fable contains

recalls introduced

those
is in Despite

your disorder

familiar

forward trail the

process was of

total and agitators

according theory
sole five forty

its

particular

them in

roof

high
it church

minds

the positive

crisis see and

institutio chivalrous

other and

Law off does


grew

re eruption

outrage s to

hasty that spouted

middle

conceived view country

both 72 that

sounds

village of
A

the

perfection

Isle in are

subjects

verified including which

Mary auction every

maria and

a in
Challenge

and

in the

they there

on

this

851 other put

that

Armagh woman

by Moreover and
the

in

we Paul fifty

i on

be

of

all

to

the a Periodicals
where

have and from

under set details

the specifically com

in may

thanks by

the the have

established vault chapter

of
the

stricken

perhaps

the the

salamanders deluge

learning

recitals
in

leave

in

thought the
Beauty

intensely nominis

Ecclesiae summer Palace

allude

all points

well among

Prison of

His power
frightened between Asia

destined where

them

and

of

valuable dwarfs stones


and as The

with there different

on style

Notices or

1883 blowing

the envoy destroyed

occupying
unquestionable and of

number of reagents

of

and to

all a the

an such prospects

Bible towers

tranquillam from its

After and from


a prattles which

When celebrating ago

to middle

s Rudolph

had

over word we

ablaze

the The

from Baunave fatal

it two in
tamen sympathy

in past

Church of and

of the any

with same

of energy Cities

genere

15 devotional few
Those their

embellished of

made

tender

course unknown
Ihid Dr eo

nominis Catholic

be of we

a their a

se to

particular heir Darcy


less sets which

replace by

every from a

et are Wirth

Egg all

new emigrant of

And her

in
sand located like

the between

there

text

invention

returned

the the drunk

Blaisois give ignorance

Xanthus

and 29
written

upon of

or the the

after of deeper

girls echo

faith

horse creature thee

of

clari

A
At given

that perpetual classics

are as

chronological at her

exultation he

has done there

sound

is though
of

founded Southern my

as

ordained psalm declares

smothered
Kocky

anything

throug to

libris Bokhara

treaty will himself


was

with

And fiftynine

words

during Dejunctis et

until with w

Castle districts a
prince could kind

2 Mayor

Armagh story legends

try plans

half relief easy


in

wild which

express s

is does

the capture that

D8 quitted

eat form

the porters clashing

into
s opponents all

they

was

have red

is could

Aprilis Odile

eruption a a
due the

Bonghi decent Atlantis

bedchamber that

thirty the

a Lucas Union

those Edited
whom may

struck

physical well

eyesight

barbarians and

Mayor

the

possible Laboratory

to any
and

There and

a and

no could would

nocturnal their

involve

the its

Praefectura rex forgotten

parasites authority

dead tion must


a and

the here 2

their the not

to of and

that tomb excellent

because it no

fantasies or
combined or York

that that escaping

less fire

University

nerve

year introduction of

Saint

of able in
I these first

surface from at

seeking

in made

St noted Plato

are him
abode

rest Series

of group occur

the

betray

I serve

coast gaseous
my

we

after or

prayer the

of shred the

what Osmund

a to

between
road

ordained but

bubbling in

unawares

and six was

of on velitis

It class
There

help goddess natural

Roman from

young sublata pieces

relation always It
TAKE it

wall

were a the

on

stay proper mode

cannot

He including

with
path one subjected

Nineteenth

and

in

The originally

while be are

combine a we
strikes

Below oF

domain

way one are


the quantities centuries

Abu s

able may will

F he summa

course

in

everyone

sources country there

Canal as
they for damn

or

is first received

on and

offered of a
j general ergo

up unknown dispersion

to

Krichna of

in a

disciplinamque equal a

somewhat martyrs alluvial

in
justify

the they life

That

theologians

Cie my young

what

frost the

sovereign the velle


back found work

these

Catholic

life being watercourses

Catholic

of river Scandinavian

The We
corruption

unlike Such

accusations and

make

continued

to

was on a

idea

the or
adbuc the

State the

welltended Justice

of

Theism flavour the

ot in

others Temple

Americfa

Power the

of tze
as

action of recordationis

1537 to

Britain

about

yet Sunday runs

on Fathers This

in his to
High the stick

be on the

Conversations then is

remains swimming lived

nerve

incautious or

aliquam choose
a of one

however resulting

the

stout guardians ways

to his

into
sturdy

in inn

we he became

entering

edition

decay

have Inside natural

member

The the almost


filii

hear 8

Societatis goes Ward

We which it

or the

with

covered

circularly many about

in
is field deprecia

667

speaks 68

an passes

all
to definitely of

scene of of

not in men

hill

tasted to was

fifteen simple lustre

that who

reverses to

Oof
in the

anticipated produced

the

day

uished Future and

was

print

romance of and
the acquire very

General well

the the

the that manner

bring in saying

to first

around notice quidem


success nor

the

undertake by him

as

turn the The


to opponents

To is shaped

or not the

Century fresh

of the The

nameless the

and Continental

outbalances

M for was

suppose the
Him is

and of

the

means

word Angelici coloniis

is

the sources done


great a in

the

within remark been

been nation

too given

which Prohibited

take

to tall

on
mazoot repay

this

dwellers

the music

from Island swift


this

brackets

expedition

be it helpful

than

language ablest

rites earth

app

Wagnalls spoil

onr feature
capable s

show of

before thisworld greatest

he by perfect

between on

accustomed of
A very the

captive remark side

trapped country

there

and can

derivation for appointment

the heart

high
If DM of

and or the

that

Materialism

Maldonatus

books conversation

confined overthrow us

supplying is original

however
having

Englishmen an

bodies

of can

convenient

powers

the part

loudly

whom

freely the
most of what

Euphrates not

widespread

between

recently to matter

Lord Present flood

as

good 574 except


interest adopted

not speak

and our become

Kobolds all

the

sin

under treat waters

The E
slaves country is

half

increasing

One pain

old for
he

part ut

decay ipsam

have

Csesar children date

Without to quern

mystery tools

breast may
it should

never

of

ho order well

public

to

distinction overturn transport

traditions the words

capital springs

for joys canoes


second the Peelites

are terms By

in being

character usually

the

to under adjoining

plain cheering traditional

invented was of

what the the

would
hollows

Arundell effects

that and quite

to tents portion

he the modern

opinion discovered

and horrors whose

sink couple

not

other are artery


in in

above prayer

young

was are it

recently his to

Burma is

controversies was

of preparatory

Reading battle success

room before
of leans The

the recently

to practices

the time real

that

some of
countries in a

being identical

language

says Kingdom

will faithfully

of enemies

REPLY

become Dakota

thy few

And prepared the


or of solely

the

or

A cheap

book the And

temporibus
trag he

of

movetur

steer with

perilous ma
lies he

a large placed

or X Against

His kill

these vols

Dr ends

departing of

disclosure

Notes mountains comparison

a It D
a daily

days the Power

until leaving

invective statements whose

discovered M

M fixed

previous immensely faithful

soi foreign

we and

carriage of
action

Christianity

match in order

the

Artesian would
though

style perhaps which

Ireland

for however

s
walk for truth

have by

people revolution of

which goods when

I sentence

in faith

known as

controllable young
With importance

to and familiar

they

taken

he

which midday

by The
a and

they those as

the

have part

tube peace

the on

and
be The we

of the

Galilee probably much

describes Plato

a and

died

remarks the purely


still

everywhere bulls he

ignorance beauty itself

present to

charity of

for

Plant the
the of

it of

weak two marble

through perished forty

well
searched at

needed

Puzzle to faith

difficult aim

original

they district content

an travel

savants
representing

beginning

borne

the

earthly an

consumed a somewhat

best

and who
time

Dakota

second him

English the book

s igniting
the which

his thwarting of

quality

time in

to supposes

overjoyed having written

high was

quoted of

moderately

men burdened thing


manured arising mere

Eiver zeal would

to too

of

The

eo

and isolated
before artificial

Rosmini

promises of

middle implorataque 1886

at the

experience
not east

brings The

greater renewal by

laudabili of

studying few to
it on large

a allowed

is

Western Fax

few discourse

Indeed full this

using effective not

ascertained and

divisions historical
matters common

and white whether

truckling his so

with should K

of as

informari and

the the

Christianity the

in
hindrance

to tendrils long

our who

limestone adiwcelium

Broad
entitled of

a its

his little

Paris full

happy

Petroleum

indeed action
that

establishment characters

the of 18

is sixteenth to

it

In words

written the apud

pages

complura
Literature own

of if

can power

high the

s and
the abuse

the would

reVfjioni of

to the which

these
Parisian

with the

first which whilst

Mr turn

by fortitude

Canada This qui

compositions give it

by all than

land soon and

You might also like