0% found this document useful (0 votes)
4 views

Data Structures Algorithms In Python 1st John Canning Alan Broder pdf download

The document is a comprehensive guide on data structures and algorithms in Python, authored by John Canning and Alan Broder. It covers various topics including arrays, sorting, trees, graphs, and their applications, along with visualizations and programming projects. Additionally, it emphasizes Pearson's commitment to diversity, equity, and inclusion in educational content.

Uploaded by

erlynpyslar
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)
4 views

Data Structures Algorithms In Python 1st John Canning Alan Broder pdf download

The document is a comprehensive guide on data structures and algorithms in Python, authored by John Canning and Alan Broder. It covers various topics including arrays, sorting, trees, graphs, and their applications, along with visualizations and programming projects. Additionally, it emphasizes Pearson's commitment to diversity, equity, and inclusion in educational content.

Uploaded by

erlynpyslar
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/ 90

Data Structures Algorithms In Python 1st John

Canning Alan Broder download

https://ebookbell.com/product/data-structures-algorithms-in-
python-1st-john-canning-alan-broder-43812882

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Data Structures Algorithms In Python 1st John Canning Alan Broder

https://ebookbell.com/product/data-structures-algorithms-in-
python-1st-john-canning-alan-broder-55621906

Data Structures And Algorithms In Python 1st Edition Michael T


Goodrich

https://ebookbell.com/product/data-structures-and-algorithms-in-
python-1st-edition-michael-t-goodrich-4178312

Data Structures And Algorithms In Python Beginners And Intermediate


Jain

https://ebookbell.com/product/data-structures-and-algorithms-in-
python-beginners-and-intermediate-jain-36687616

Data Structures And Algorithms In Python Michael T Goodrich

https://ebookbell.com/product/data-structures-and-algorithms-in-
python-michael-t-goodrich-49492894
Data Structures And Algorithms In Python Michael H Goldwasser

https://ebookbell.com/product/data-structures-and-algorithms-in-
python-michael-h-goldwasser-32715654

Data Structures And Algorithms In Python Goodrich Mt Tamassia R

https://ebookbell.com/product/data-structures-and-algorithms-in-
python-goodrich-mt-tamassia-r-4581952

Data Structures With Python Get Familiar With The Common Data
Structures And Algorithms In Python Dr Harsh Bhasin

https://ebookbell.com/product/data-structures-with-python-get-
familiar-with-the-common-data-structures-and-algorithms-in-python-dr-
harsh-bhasin-50687252

Data Structures With Python Get Familiar With The Common Data
Structures And Algorithms In Python Dr Harsh Bhasin

https://ebookbell.com/product/data-structures-with-python-get-
familiar-with-the-common-data-structures-and-algorithms-in-python-dr-
harsh-bhasin-49443880

A Commonsense Guide To Data Structures And Algorithms In Python Volume


1 Level Up Your Core Programming Skills Jay Wengrow

https://ebookbell.com/product/a-commonsense-guide-to-data-structures-
and-algorithms-in-python-volume-1-level-up-your-core-programming-
skills-jay-wengrow-57742868
Data Structures & Algorithms in Python
Data Structures & Algorithms in
Python

John Canning
Alan Broder
Robert Lafore

Boston • Columbus • New York • San Francisco • Amsterdam • Cape Town


Dubai • London • Madrid • Milan • Munich • Paris • Montreal • Toronto • Delhi • Mexico City
São Paulo • Sidney • Hong Kong • Seoul • Singapore • Taipei • Tokyo
Many of the designations used by manufacturers and sellers to distinguish their products are claimed
as trademarks. Where those designations appear in this book, and the publisher was aware of a
trademark claim, the designations have been printed with initial capital letters or in all capitals.
The authors and publisher have taken care in the preparation of this book, but make no expressed or
implied warranty of any kind and assume no responsibility for errors or omissions. No liability is
assumed for incidental or consequential damages in connection with or arising out of the use of the
information or programs contained herein.
For information about buying this title in bulk quantities, or for special sales opportunities (which
may include electronic versions; custom cover designs; and content particular to your business,
training goals, marketing focus, or branding interests), please contact our corporate sales department
at corpsales@pearsoned.com or (800) 382-3419.
For government sales inquiries, please contact governmentsales@pearsoned.com.
For questions about sales outside the U.S., please contact intlcs@pearson.com.
Visit us on the Web: informit.com/aw
Library of Congress Control Number: 2022910068
Copyright © 2023 Pearson Education, Inc.
All rights reserved. Printed in the United States of America. This publication is protected by
copyright, and permission must be obtained from the publisher prior to any prohibited reproduction,
storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical,
photocopying, recording, or likewise. For information regarding permissions, request forms and the
appropriate contacts within the Pearson Education Global Rights & Permissions Department, please
visit www.pearsoned.com/permissions/.
ISBN-13: 978-0-13-485568-4
ISBN-10: 0-13-485568-X
ScoutAutomatedPrintCode
Editor-in-Chief
Mark Taub
Director, ITP Product Management
Brett Bartow
Acquisitions Editor
Kim Spenceley
Development Editor
Chris Zahn
Managing Editor
Sandra Schroeder
Project Editor
Mandie Frank
Copy Editor
Chuck Hutchinson
Indexer
Proofreader
Editorial Assistant
Cindy Teeters
Designer
Chuti Prasertsith
Compositor
codeMantra
Pearson’s Commitment to
Diversity, Equity, and Inclusion
Pearson is dedicated to creating bias-free content that reflects the diversity
of all learners. We embrace the many dimensions of diversity, including but
not limited to race, ethnicity, gender, socioeconomic status, ability, age,
sexual orientation, and religious or political beliefs.
Education is a powerful force for equity and change in our world. It has the
potential to deliver opportunities that improve lives and enable economic
mobility. As we work with authors to create content for every product and
service, we acknowledge our responsibility to demonstrate inclusivity and
incorporate diverse scholarship so that everyone can achieve their potential
through learning. As the world’s leading learning company, we have a duty
to help drive change and live up to our purpose to help more people create a
better life for themselves and to create a better world.
Our ambition is to purposefully contribute to a world where
• Everyone has an equitable and lifelong opportunity to succeed
through learning
• Our educational products and services are inclusive and represent the
rich diversity of learners
• Our educational content accurately reflects the histories and
experiences of the learners we serve
• Our educational content prompts deeper discussions with learners and
motivates them to expand their own learning (and worldview)
While we work hard to present unbiased content, we want to hear from you
about any concerns or needs with this Pearson product so that we can
investigate and address them.
Please contact us with concerns about any potential bias at
https://www.pearson.com/report-bias.html.
To my mother, who gave me a thirst for knowledge, to my father, who
taught me the joys of engineering, and to June, who made it possible to
pursue both.

John Canning

For my father Sol Broder, a computer science pioneer, who inspired me to


follow in his footsteps.

To my mother Marilyn Broder, for showing me the satisfaction of teaching


others.

To Fran, for making my life complete.

Alan Broder
Contents
1. Overview

2. Arrays

3. Simple Sorting

4. Stacks and Queues

5. Linked Lists

6. Recursion

7. Advanced Sorting

8. Binary Trees

9. 2-3-4 Trees and External Storage

10. AVL and Red-Black Trees

11. Hash Tables

12. Spatial Data Structures

13. Heaps

14. Graphs

15. Weighted Graphs

16. What to Use and Why


Appendix A. Running the Visualizations

Appendix B. Further Reading

Appendix C. Answers to Questions


Table of Contents
1. Overview
What Are Data Structures and Algorithms?
Overview of Data Structures
Overview of Algorithms
Some Definitions
Programming in Python
Object-Oriented Programming
Summary
Questions
Experiments

2. Arrays
The Array Visualization Tool
Using Python Lists to Implement the Array Class
The Ordered Array Visualization Tool
Python Code for an Ordered Array Class
Logarithms
Storing Objects
Big O Notation
Why Not Use Arrays for Everything?
Summary
Questions
Experiments
Programming Projects

3. Simple Sorting
How Would You Do It?
Bubble Sort
Selection Sort
nsertion Sort
Comparing the Simple Sorts
Summary
Questions
Experiments
Programming Projects

4. Stacks and Queues


Different Structures for Different Use Cases
Stacks
Queues
Priority Queues
Parsing Arithmetic Expressions
Summary
Questions
Experiments
Programming Projects

5. Linked Lists
Links
The Linked List Visualization Tool
A Simple Linked List
Linked List Efficiency
Abstract Data Types and Objects
Ordered Lists
Doubly Linked Lists
Circular Lists
terators
Summary
Questions
Experiments
Programming Projects
6. Recursion
Triangular Numbers
Factorials
Anagrams
A Recursive Binary Search
The Tower of Hanoi
Sorting with mergesort
Eliminating Recursion
Some Interesting Recursive Applications
Summary
Questions
Experiments
Programming Projects

7. Advanced Sorting
Shellsort
Partitioning
Quicksort
Degenerates to O(N2) Performance
Radix Sort
Timsort
Summary
Questions
Experiments
Programming Projects

8. Binary Trees
Why Use Binary Trees?
Tree Terminology
An Analogy
How Do Binary Search Trees Work?
Finding a Node
nserting a Node
Traversing the Tree
Finding Minimum and Maximum Key Values
Deleting a Node
The Efficiency of Binary Search Trees
Trees Represented as Arrays
Printing Trees
Duplicate Keys
The BinarySearchTreeTester.py Program
The Huffman Code
Summary
Questions
Experiments
Programming Projects

9. 2-3-4 Trees and External Storage


ntroduction to 2-3-4 Trees
The Tree234 Visualization Tool
Python Code for a 2-3-4 Tree
Efficiency of 2-3-4 Trees
-3 Trees
External Storage
Summary
Questions
Experiments
Programming Projects

10. AVL and Red-Black Trees


Our Approach to the Discussion
Balanced and Unbalanced Trees
AVL Trees
The Efficiency of AVL Trees
Red-Black Trees
Using the Red-Black Tree Visualization Tool
Experimenting with the Visualization Tool
Rotations in Red-Black Trees
nserting a New Node
Deletion
The Efficiency of Red-Black Trees
-3-4 Trees and Red-Black Trees
Red-Black Tree Implementation
Summary
Questions
Experiments
Programming Projects

11. Hash Tables


ntroduction to Hashing
Open Addressing
Separate Chaining
Hash Functions
Hashing Efficiency
Hashing and External Storage
Summary
Questions
Experiments
Programming Projects

12. Spatial Data Structures


Spatial Data
Computing Distances Between Points
Circles and Bounding Boxes
Searching Spatial Data
Lists of Points
Grids
Quadtrees
Theoretical Performance and Optimizations
Practical Considerations
Further Extensions
Summary
Questions
Experiments
Programming Projects

13. Heaps
ntroduction to Heaps
The Heap Visualization Tool
Python Code for Heaps
A Tree-Based Heap
Heapsort
Order Statistics
Summary
Questions
Experiments
Programming Projects

14. Graphs
ntroduction to Graphs
Traversal and Search
Minimum Spanning Trees
Topological Sorting
Connectivity in Directed Graphs
Summary
Questions
Experiments
Programming Projects

15. Weighted Graphs


Minimum Spanning Tree with Weighted Graphs
The Shortest-Path Problem
The All-Pairs Shortest-Path Problem
Efficiency
ntractable Problems
Summary
Questions
Experiments
Programming Projects

16. What to Use and Why


Analyzing the Problem
Foundational Data Structures
Special-Ordering Data Structures
Sorting
Specialty Data Structures
External Storage
Onward

Appendix A. Running the Visualizations


For Developers: Running and Changing the Visualizations
For Managers: Downloading and Running the Visualizations
For Others: Viewing the Visualizations on the Internet
Using the Visualizations

Appendix B. Further Reading


Data Structures and Algorithms
Object-Oriented Programming Languages
Object-Oriented Design (OOD) and Software Engineering

Appendix C. Answers to Questions


Chapter 1, “Overview”
Chapter 2, “Arrays”
Chapter 3, “Simple Sorting”
Chapter 4, “Stacks and Queues”
Chapter 5, “Linked Lists”
Chapter 6, “Recursion”
Chapter 7, “Advanced Sorting”
Chapter 8, “Binary Trees”
Chapter 9, “2-3-4 Trees and External Storage”
Chapter 10, “AVL and Red-Black Trees”
Chapter 11, “Hash Tables”
Chapter 12, “Spatial Data Structures”
Chapter 13, “Heaps”
Chapter 14, “Graphs”
Chapter 15, “Weighted Graphs”
Register your copy of Data Structures & Algorithms in Python at
informit.com for convenient access to downloads, updates, and corrections
as they become available. To start the registration process, go to
informit.com/register and log in or create an account. Enter the product
ISBN 9780134855684 and click Submit. Once the process is complete, you
will find any available bonus content under “Registered Products.”
Acknowledgments
From John Canning and Alan Broder
Robert Lafore’s Java-based version of this book has been a mainstay in
Data Structures courses and professionals’ reference shelves around the
world for many years. When Alan’s Data Structures course at Stern College
for Women of Yeshiva University moved on to Python, the inability to use
Lafore’s book in the course was a real loss. We’re thus especially happy to
bring this new and revised edition to the world of Python programmers and
students.
We’d like to thank the many students at Stern who contributed to this book
either directly or indirectly over the past several years. Initial Python
versions of Lafore’s Java implementations were central to Alan’s Python-
based courses, and Stern student feedback helped improve the code’s
clarity, enhanced its performance, and sometimes even identified and fixed
bugs!
For their valuable feedback and recommendations on early drafts of this
new edition, we are grateful to many students in Alan’s Data Structures
courses, including Estee Brooks, Adina Bruce, Julia Chase, Hanna Fischer,
Limor Kohanim, Elisheva Kohn, Shira Orlian, Shira Pahmer, Jennie Peled,
Alexandra Roffe, Avigail Royzenberg, Batia Segal, Penina Waghalter, and
Esther Werblowsky. Our apologies if we’ve omitted anyone’s name.
An open-source package of data structure visualizations is available to
enhance your study of this book, and Stern students played an active role in
the development of the visualization software. John and Alan extend many
thanks to the Stern student pioneers and leaders of this project, including
Ilana Radinsky, Elana Apfelbaum, Ayliana Teitelbaum, and Lily Polonetsky,
as well as the following past and present Stern student contributors: Zoe
Abboudi, Ayelet Aharon, Lara Amar, Natania Birnbaum, Adina Bruce,
Chani Dubin, Sarah Engel, Sarah Graff, Avigayil Helman, Michal
Kaufman, Sarina Kofman, Rachel Leiser, Talia Leitner, Shani Lewis, Rina
Melincoff, Atara Neugroschl, Shira Pahmer, Miriam Rabinovich, Etta Rapp,
Shira Sassoon, Mazal Schoenwald, Shira Schneider, Shira Smith, Riva
Tropp, Alexandra Volchek, and Esther Werblowsky. Our apologies if we
have left anyone off this list.
Many thanks go to Professor David Matuszek of the University of
Pennsylvania for his early contributions of ideas and PowerPoint slides
when Alan first started teaching Data Structures at Stern. Many of the slides
available in the Instructors Resources section have their origin in his clear
and well-designed slides. Also, we are grateful to Professor Marian Gidea
of the Department of Mathematics of Yeshiva University for his insights
into spherical trigonometry.
Finally, we owe a great debt to the talented editors at Pearson who made
this book a reality: Mark Taber, Kim Spenceley, Mandie Frank, and Chris
Zahn. Without their many talents and patient help, this project would just be
an odd collection of text files, drawings, and source code.
From Robert Lafore for the Java-based versions of the book

Acknowledgments to the First Edition


My gratitude for the following people (and many others) cannot be fully
expressed in this short acknowledgment. As always, Mitch Waite had the
Java thing figured out before anyone else. He also let me bounce the applets
off him until they did the job, and extracted the overall form of the project
from a miasma of speculation. My editor, Kurt Stephan, found great
reviewers, made sure everyone was on the same page, kept the ball rolling,
and gently but firmly ensured that I did what I was supposed to do. Harry
Henderson provided a skilled appraisal of the first draft, along with many
valuable suggestions. Richard S. Wright, Jr., as technical editor, corrected
numerous problems with his keen eye for detail. Jaime Niño, Ph.D., of the
University of New Orleans, attempted to save me from myself and
occasionally succeeded, but should bear no responsibility for my approach
or coding details. Susan Walton has been a staunch and much-appreciated
supporter in helping to convey the essence of the project to the
nontechnical. Carmela Carvajal was invaluable in extending our contacts
with the academic world. Dan Scherf not only put the CD-ROM together,
but was tireless in keeping me up to date on rapidly evolving software
changes. Finally, Cecile Kaufman ably shepherded the book through its
transition from the editing to the production process.

Acknowledgments to the Second Edition


My thanks to the following people at Sams Publishing for their competence,
effort, and patience in the development of this second edition. Acquisitions
Editor Carol Ackerman and Development Editor Songlin Qiu ably guided
this edition through the complex production process. Project Editor Matt
Purcell corrected a semi-infinite number of grammatical errors and made
sure everything made sense. Tech Editor Mike Kopak reviewed the
programs and saved me from several problems. Last but not least, Dan
Scherf, an old friend from a previous era, provides skilled management of
my code and applets on the Sams website.
About the Author
Dr. John Canning is an engineer, computer scientist, and researcher. He
earned an S.B. degree in electrical engineering from the Massachusetts
Institute of Technology and a Ph.D. in Computer Science from the
University of Maryland at College Park. His varied professions include
being a professor of computer science, a researcher and software engineer
in industry, and a company vice president. He now is president of
Shakumant Software.
Alan Broder is clinical professor and chair of the Department of Computer
Science at Stern College for Women of Yeshiva University in New York
City. He teaches introductory and advanced courses in Python
programming, data structures, and data science. Before joining Stern
College, he was a software engineer, designing and building large-scale
data analysis systems. He founded and led White Oak Technologies, Inc. as
its CEO, and later served as the chairman and fellow of its successor
company, Novetta, in Fairfax, Virginia.
Introduction
What’s in this book? This book is designed to be a practical introduction to
data structures and algorithms for students who have just begun to write
computer programs. This introduction will tell you more about the book,
how it is organized, what experience we expect readers will have before
starting the book, and what knowledge you will get by reading it and doing
the exercises.

Who This Book Is For


Data structures and algorithms are the core of computer science. If you’ve
ever wanted to understand what computers can do, how they do it, and what
they can’t do, then you need a deep understanding of both (it’s probably
better to say “what computers have difficulty doing” instead of what they
can’t do). This book may be used as a text in a data structures and/or
algorithms course, frequently taught in the second year of a university
computer science curriculum. The text, however, is also designed for
professional programmers, for high school students, and for anyone else
who needs to take the next step up from merely knowing a programming
language. Because it’s easy to understand, it is also appropriate as a
supplemental text to a more formal course. It is loaded with examples,
exercises, and supplemental materials, so it can be used for self-study
outside of a classroom setting.
Our approach in writing this book is to make it easy for readers to
understand how data structures operate and how to apply them in practice.
That’s different from some other texts that emphasize the mathematical
theory, or how those structures are implemented in a particular language or
software library. We’ve selected examples with real-world applications and
avoid using math-only or obscure examples. We use figures and
visualization programs to help communicate key ideas. We still cover the
complexity of the algorithms and the math needed to show how complexity
impacts performance.

What You Need to Know Before You Read This


Book
The prerequisites for using this book are: knowledge of some programming
language and some mathematics. Although the sample code is written in
Python, you don’t need to know Python to follow what’s happening. Python
is not hard to understand, if you’ve done some procedural and/or object-
oriented programming. We’ve kept the syntax in the examples as general as
possible,
More specifically, we use Python version 3 syntax. This version differs
somewhat from Python 2, but not greatly. Python is a rich language with
many built-in data types and libraries that extend its capabilities. Our
examples, however, use the more basic constructs for two reasons: it makes
them easier to understand for programmers familiar with other languages,
and it illustrates the details of the data structures more explicitly. In later
chapters, we do make use of some Python features not found in other
languages such as generators and list comprehensions. We explain what
these are and how they benefit the programmer.
Of course, it will help if you’re already familiar with Python (version 2 or
3). Perhaps you’ve used some of Python’s many data structures and are
curious about how they are implemented. We review Python syntax in
Chapter 1, “Overview,” for those who need an introduction or refresher. If
you’ve programmed in languages like Java, C++, C#, JavaScript, or Perl,
many of the constructs should be familiar. If you’ve only programmed
using functional or domain-specific languages, you may need to spend more
time becoming familiar with basic elements of Python. Beyond this text,
there are many resources available for novice Python programmers,
including many tutorials on the Internet.
Besides a programming language, what should every programmer know? A
good knowledge of math from arithmetic through algebra is essential.
Computer programming is symbol manipulation. Just like algebra, there are
ways of transforming expressions to rearrange terms, put them in different
forms, and make certain parts more prominent, all while preserving the
same meaning. It’s also critical to understand exponentials in math. Much
of computer science is based on knowing what raising one number to a
power of another means. Beyond math, a good sense of organization is also
beneficial for all programming. Knowing how to organize items in different
ways (by time, by function, by size, by complexity, and so on) is crucial to
making programs efficient and maintainable. When we talk about efficiency
and maintainability, they have particular meanings in computer science.
Efficiency is mostly about how much time it takes to compute things but can
also be about the amount of space it takes. Maintainability refers to the ease
of understanding and modifying your programs by other programmers as
well as yourself.
You’ll also need knowledge of how to find things on the Internet, download
and install software, and run them on a computer. The instructions for
downloading and running the visualization programs can be found in
Appendix A of this book. The Internet has made it very easy to access a
cornucopia of tools, including tools for learning programming and
computer science. We expect readers to already know how to find useful
resources and avoid sources that might provide malicious software.

What You Can Learn from This Book


As you might expect from its title, this book can teach you about how data
structures make programs (and programmers) more efficient in their work.
You can learn how data organization and its coupling with appropriate
algorithms greatly affect what can be computed with a given amount of
computing resources. This book can give you a thorough understanding of
how to implement the data structures, and that should enable you to
implement them in any programming language. You can learn the process
of deciding what data structure(s) and algorithms are the most appropriate
to meet a particular programming request. Perhaps most importantly, you
can learn when an algorithm and/or data structure will fail in a given use
case. Understanding data structures and algorithms is the core of computer
science, which is different from being a Python (or other language)
programmer.
The book teaches the fundamental data structures that every programmer
should know. Readers should understand that there are many more. These
basic data structures work in a wide variety of situations. With the skills
you develop in this book, you should be able to read a description of
another data structure or algorithm and begin to analyze whether or not it
will outperform or perform worse than the ones you’ve already learned in
particular use cases.
This book explains some Python syntax and structure, but it will not teach
you all its capabilities. The book uses a subset of Python’s full capabilities
to illustrate how more complex data structures are built from the simpler
constructs. It is not designed to teach the basics of programming to
someone who has never programmed. Python is a very high-level language
with many built-in data structures. Using some of the more primitive types
such as arrays of integers or record structures, as you might find in C or
C++, is somewhat more difficult in Python. Because the book’s focus is the
implementation and analysis of data structures, our examples use
approximations to these primitive types. Some Python programmers may
find these examples unnecessarily complex, knowing about the more
elegant constructs provided with the language in standard libraries. If you
want to understand computer science, and in particular, the complexity of
algorithms, you must understand the underlying operations on the
primitives. When you use a data structure provided in a programming
language or from one of its add-on modules, you will often have to know its
complexity to know whether it will work well for your use case.
Understanding the core data structures, their complexities, and trade-offs
will help you understand the ones built on top of them.
All the data structures are developed using object-oriented programming
(OOP). If that’s a new concept for you, the review in Chapter 1 of how
classes are defined and used in Python provides a basic introduction to
OOP. You should not expect to learn the full power and benefits of OOP
from this text. Instead, you will learn to implement each data structure as a
class. These classes are the types of objects in OOP and make it easier to
develop software that can be reused by many different applications in a
reliable way.
The book uses many examples, but this is not a book about a particular
application area of computer science such as databases, user interfaces, or
artificial intelligence. The examples are chosen to illustrate typical
applications of programs, but all programs are written in a particular
context, and that changes over time. A database program written in 1970
may have appeared very advanced at that time, but it might seem very
trivial today. The examples presented in this text are designed to teach how
data structures are implemented, how they perform, and how to compare
them when designing a new program. The examples should not be taken as
the most comprehensive or best implementation possible of each data
structure, nor as a thorough review of all the potential data structures that
could be appropriate for a particular application area.

Structure
Each chapter presents a particular group of data structures and associated
algorithms. At the end of the chapters, we provide review questions
covering the key points in the chapter and sometimes relationships to
previous chapters. The answers for these can be found in Appendix C,
“Answers to Questions.” These questions are intended as a self-test for
readers, to ensure you understood all the material.
Many chapters suggest experiments for readers to try. These can be
individual thought experiments, team assignments, or exercises with the
software tools provided with the book. These are designed to apply the
knowledge just learned to some other area and help deepen your
understanding.
Programming projects are longer, more challenging programming exercises.
We provide a range of projects of different levels of difficulty. These
projects might be used in classroom settings as homework assignments.
Sample solutions to the programming projects are available to qualified
instructors from the publisher.

History
Mitchell Waite and Robert Lafore developed the first version of this book
and titled it Data Structures and Algorithms in Java. The first edition was
published in 1998, and the second edition, by Robert, came out in 2002.
John Canning and Alan Broder developed this version using Python due to
its popularity in education and commercial and noncommercial software
development. Java is widely used and an important language for computer
scientists to know. With many schools adopting Python as a first
programming language, the need for textbooks that introduce new concepts
in an already familiar language drove the development of this book. We
expanded the coverage of data structures and updated many of the
examples.
We’ve tried to make the learning process as painless as possible. We hope
this text makes the core, and frankly, the beauty of computer science
accessible to all. Beyond just understanding, we hope you find learning
these ideas fun. Enjoy yourself!
1. Overview
You have written some programs and learned enough to think that
programming is fun, or at least interesting. Some parts are easy, and some parts
are hard. You’d like to know more about how to make the process easier, get
past the hard parts, and conquer more complex tasks. You are starting to study
the heart of computer science, and that brings up many questions. This chapter
sets the stage for learning how to make programs that work properly and fast. It
explains a bunch of new terms and fills in background about the programming
language that we use in the examples.

In This Chapter
• What Are Data Structures and Algorithms?
• Overview of Data Structures
• Overview of Algorithms
• Some Definitions
• Programming in Python
• Object-Oriented Programming

What Are Data Structures and Algorithms?


Data organizations are ways data is arranged in the computer using its various
storage media (such as random-access memory, or RAM, and disk) and how
that data is interpreted to represent something. Algorithms are the procedures
used to manipulate the data in these structures. The way data is arranged can
simplify the algorithms and make algorithms run faster or slower. Together, the
data organization and the algorithm form a data structure. The data structures
act like building blocks, with more complex data structures using other data
structures as components with appropriate algorithms.
Does the way data is arranged and the algorithm used to manipulate it make a
difference? The answer is a definite yes. From the perspective of
nonprogrammers, it often seems as though computers can do anything and do it
very fast. That’s not really true. To see why, let’s look at a nonprogramming
example.
When you cook a meal, a collection of ingredients needs to be combined and
manipulated in specific ways. There is a huge variety of ways that you could
go about the individual steps needed to complete the meal. Some of those
methods are going to be more efficient than others. Let’s assume that you have
a written recipe, but are working in an unfamiliar kitchen, perhaps while
visiting a friend. One method for making the meal would be Method A:
1. Read through the full recipe noting all the ingredients it mentions, their
quantities, and any equipment needed to process them.
2. Find the ingredients, measure out the quantity needed, and store them.
3. Get out all the equipment needed to complete the steps in the recipe.
4. Go through the steps of the recipe in the order specified.
Let’s compare that to Method B:
1. Read the recipe until you identify the first set of ingredients or equipment
that is needed to complete the first step.
2. Find the identified ingredients or equipment.
3. Measure any ingredients found.
4. Perform the first step with the equipment and ingredients already found.
5. Return to the beginning of this method and repeat the instructions
replacing the word first with next. If there is no next step, then quit.
Both methods are complete in that that they should finish the complete recipe if
all the ingredients and equipment are available. For simple recipes, they should
take about the same amount of time too. The methods differ as the recipes get
more complex. For example, what if you can’t find the fifth ingredient? In
method A, that issue is identified at the beginning before any other ingredients
are combined. While neither method really explains what to do about
exceptions like a missing ingredient, you can still compare them under the
assumption that you handle the exceptions the same way.
A missing ingredient could be handled in several ways: find a substitute
ingredient, broaden the search for the ingredient (look in other rooms, ask a
neighbor, go to the market), or ignore the ingredient (an optional garnish). Each
of those remedies takes some time. If there is one missing ingredient and two
cooks using the different methods handle it in the same way, both are delayed
the same amount of time. If there are multiple missing ingredients, however,
Method A should identify those earlier and allow for the possibility of getting
all the missing ingredients in one visit to a neighbor or a market. The time
savings of combining the tasks of replacing missing ingredients could be
significant (imagine the market being far away or neighbors who want to talk
for hours on every visit).
The order of performing the operations could have significant impact on the
time needed to complete the meal. Another difference could be in the quality of
the meal. For example, in Method B the cook would perform the first “step”
and then move on to the next step. Let’s assume those use two different groups
of ingredients or equipment. If finding or measuring the ingredients, or getting
the equipment for the later steps takes significant time, then the results of the
first step sit around for a significant time. That can have a bad effect on the
quality of the meal. The cook might be able to overcome that effect in some
circumstances by, say, putting the results of the first step in a freezer or
refrigerator and then bringing them back to room temperature later. The cook
would be preserving the quality of the food at the expense of the time needed
to prepare it.
Would Method B ever be desirable if it takes longer or risks degrading the
quality of the food? Perhaps. Imagine that the cook is preparing this meal in the
unfamiliar kitchen of a family relative. The kitchen is full of family members,
and each one is trying to make part of the meal. In this crowded situation, it
could be difficult for each cook to get out all of their ingredients and equipment
at once. There might not be enough counter space, or mixing bowls, or knives,
for example, for each cook to have all their items assembled at the beginning.
The cooks could be constrained to work on individual steps while waiting for
equipment, space, or ingredients to become available. In this case, Method B
could have advantages over asking all the cooks to work one at a time using
Method A.
Coming back to programming, the algorithm specifies the sequence of
operations that are to be performed, much like the steps in the recipe. The data
organizations are somewhat analogous to how the ingredients are stored, laid
out in the kitchen, and their proximity to other ingredients and equipment. For
example, having the ingredient in the kitchen makes the process much faster
than if the ingredient needs to be retrieved from a neighbor or the market. You
can think of the amount of space taken up by spreading out the ingredients in
various locations as the amount of space needed for the algorithm. Even if all
the ingredients are in the kitchen where the cook is, there are ways of setting up
the ingredients to make the cooking tasks go faster. Having them compactly
arranged in the order they are needed minimizes the amount of moving around
the cook must do. The organization of the ingredients can also help if a cook
must be replaced by another cook in the middle of the preparation;
understanding where each of the ingredients fits in to the recipe is faster if the
layout is organized. This is another reason why good data organization is
important. It also reinforces that concept that the algorithm and the data
organization work together to make the data structure.
Data structures are important not just for speed but also to properly model the
meaning of the data. Let’s say there’s an event that many people want to attend
and they need to submit their phone number to have a chance to get tickets.
Each person can request multiple tickets. If there are fewer tickets than the
number of people who want to get them, some method needs to be applied to
decide which phone numbers to contact first and determine the number of
tickets they will receive. One method would be to go through the phone
numbers one at a time and total up the number of tickets until all are given out,
then go through the remaining numbers to let them know the tickets are gone.
That might be a fair method if the numbers were put in an ordered list defined
in a way that potential recipients understood— for example, a chronological
list of phone numbers submitted by people interested in the tickets. If the
tickets are to be awarded as a sort of lottery, then going through them
sequentially means following any bias that is implicit in the order of the list.
Randomly choosing a number from the list, contacting the buyer, and then
removing the number would be fairer in a lottery system.
Data structures model systems by assigning specific meanings to each of the
pieces and how they interact. The “systems” are real-world things like first-
come, first-served ticket sales, or a lottery giveaway, or how roads connect
cities. For the list of phone numbers with ticket requests, a first-come, first-
served system needs the list in chronological order, some pointer to where in
the list the next number should be taken, and a pointer to where any newly
arriving number should be added (after all previous list entries). The lottery
system would need a different organization, and modeling the map of roads and
cities needs another. In this book we examine a lot of different data structures.
Each one has its strengths and weaknesses and is applicable to different kinds
of real-world problems. It’s important to understand how each one operates,
whether it correctly models the behavior needed by a particular problem area,
whether it will operate efficiently to perform the operations, and whether it can
“scale” well. We say a data structure or algorithm scales well if it will perform
as efficiently as possible as the amount of data grows.

Overview of Data Structures


As we’ve discussed, not every data structure models every type of problem. Or
perhaps a better way to put it is that the structures model the problem
awkwardly or inefficiently. You can generalize the data structures somewhat by
looking at the common operations that you are likely to do across all of them.
For example, to manage the requests for tickets, you need to
• Add a new phone number (for someone who wants one or more tickets)
• Remove a phone number (for someone who later decides they don’t want
tickets)
• Find a particular phone number (the next one to get a ticket by some
method, or to look up one by its characteristics)
• List all the phone numbers (show all the phone numbers exactly once,
that is, without repeats except, perhaps, for cases where multiple
identical entries were made)
These four operations are needed for almost every data structure that manages
a large collection of similar items. We call them insertion, deletion, search,
and traversal.
Here’s a list of the data structures covered in this book and some of their
advantages and disadvantages with respect to the four operations. Table 1-1
shows a very high-level view of the structures; we look at them in much more
detail in the following chapters. One aspect mentioned in this table is the data
structure’s complexity. In this context, we’re referring to the structure’s ability
to be understood easily by programmers, not how quickly it can be
manipulated by the computer.
Table 1-1 Comparison of Different Data Types
Overview of Algorithms
Algorithms are ways to implement an operation using a data structure or group
of structures. A single algorithm can sometimes be applied to multiple data
structures with each data structure needing some variations in the algorithm.
For example, a depth first search algorithm applies to all the tree data
structures, perhaps the graph, and maybe even stacks and queues (consider a
stack as a tree with branching factor of 1). In most cases, however, algorithms
are intimately tied to particular data structures and don’t generalize easily to
others. For example, the way to insert new items or search for the presence of
an item is very specific to each data structure. We examine the algorithms for
insertion, search, deletion, and traversal for all the data structures. That
illustrates how much they vary by data structure and the complexity involved
in those structures.
Another core algorithm is sorting, where a collection of items is put in a
particular order. Ordering the items makes searching for items faster. There are
many ways to perform sort operations, and we devote Chapter 3, “Simple
Sorting,” to this topic, and revisit the problem in Chapter 7, “Advanced
Sorting.”
Algorithms are often defined recursively, where part of the algorithm refers to
executing the algorithm again on some subset of the data. This very important
concept can simplify the definition of algorithms and make it very easy to
prove the correctness of an implementation. We study that topic in more detail
in Chapter 6, “Recursion.”

Some Definitions
This section provides some definitions of key terms.

Database
We use the term database to refer to the complete collection of data that’s
being processed in a particular situation. Using the example of people
interested in tickets, the database could contain the phone numbers, the names,
the desired number of tickets, and the tickets awarded. This is a broader
definition than what’s meant by a relational database or object-oriented
database.
Record
Records group related data and are the units into which a database is divided.
They provide a format for storing information. In the ticket distribution
example, a record could contain a person’s name, a person’s phone number, a
desired number of tickets, and a number of awarded tickets. A record typically
includes all the information about some entity, in a situation in which there are
many such entities. A record might correspond to a user of a banking
application, a car part in an auto supply inventory, or a stored video in a
collection of videos.

Field
Records are usually divided into several fields. Each field holds a particular
kind of data. In the ticket distribution example, the fields could be as shown in
Figure 1-1.

Figure 1-1 A record definition for ticket distribution


The fields are named and have values. Figure 1-1 shows an empty box
representing the storage space for the value. In many systems, the type of value
is restricted to a single or small range of data types, just like variables are in
many programming languages. For example, the desired number of tickets
could be restricted to only integers, or only non-negative integers. In object-
oriented systems, objects often represent records, and each object’s attributes
are the fields of that record. The terminology can be different in the various
programming languages. Object attributes might be called members, fields, or
variables.

Key
When searching for records or sorting them, one of the fields is called the key
(or search key or sort key). Search algorithms look for an exact match of the
key value to some target value and return the record containing it. The program
calling the search routine can then access all the fields in the record. For
example, in the ticket distribution system, you might search for a record by a
particular phone number and then look at the number of desired tickets in that
record. Another kind of search could use a different key. For example, you
could search for a record using the desired tickets as search key and look for
people who want three tickets. Note in this case that you could define the
search to return the first such record it finds or a collection of all records where
the desired number of tickets is three.

Databases vs. Data Structures


The collection of records representing a database is going to require a data
structure to implement it. Each record within the database may also be
considered a data structure with its own data organization and algorithms. This
decomposition of the data into smaller and smaller units goes on until you get
to primitive data structures like integers, floating-point numbers, characters,
and Boolean values. Not all data structures can be considered databases; they
must support insertion, search, deletion, and traversal of records to implement a
database.

Programming in Python
Python is a programming language that debuted in 1991. It embraces object-
oriented programming and introduced syntax that made many common
operations very concise and elegant. One of the first things that programmers
new to Python notice is that certain whitespace is significant to the meaning of
the program. That means that when you edit Python programs, you should use
an editor that recognizes its syntax and helps you create the program as you
intend it to work. Many editors do this, and even editors that don’t recognize
the syntax by filename extension or the first few lines of text can often be
configured to use Python syntax for a particular file.

Interpreter
Python is an interpreted language, which means that even though there is a
compiler, you can execute programs and individual expressions and statements
by passing the text to an interpreter program. The compiler works by
translating the source code of a program into bytecode that is more easily read
by the machine and more efficient to process. Many Python programmers
never have to think about the compiler because the Python interpreter runs it
automatically, when appropriate.
Interpreted languages have the great benefit of allowing you to try out parts of
your code using an interactive command-line interpreter. There are often
multiple ways to start a Python interpreter, depending on how Python was
installed on the computer. If you use an Integrated Development Environment
(IDE) such as IDLE, which comes with most Python distributions, there is a
window that runs the command-line interpreter. The method for starting the
interpreter differs between IDEs. When IDLE is launched, it automatically
starts the command-line interpreter and calls it the Shell.
On computers that don’t have a Python IDE installed, you can still launch the
Python interpreter from a command-line interface (sometimes called a terminal
window, or shell, or console). In that command-line interface, type python and
then press the Return or Enter key. It should display the version of Python you
are using along with some other information, and then wait for you to type
some expression in Python. After reading the expression, the interpreter
decides if it’s complete, and if it is, computes the value of the expression and
prints it. The example in Listing 1-1 shows using the Python interpreter to
compute some math results.

Listing 1-1 Using the Python Interpreter to Do Math

$ python
Python 3.6.0 (default, Dec 23 2016, 13:19:00)
Type "help", "copyright", "credits" or "license" for more information.
>>> 2019 - 1991
28
>>> 2**32 - 1
4294967295
>>> 10**27 + 1
1000000000000000000000000001
>>> 10**27 + 1.001
1e+27
>>>

In Listing 1-1, we’ve colored the text that you type in blue italics. The first
dollar sign ($) is the prompt from command-line interpreter. The Python
interpreter prints out the rest of the text. The Python we use in this book is
version 3. If you see Python 2… on the first line, then you have an older version
of the Python interpreter. Try running python3 in the command-line interface
to see if Python version 3 is already installed on the computer. If not, either
upgrade the version of Python or find a different computer that has python3.
The differences between Python 2 and 3 can be subtle and difficult to
understand for new programmers, so it’s important to get the right version.
There are also differences between every minor release version of Python, for
example, between versions 3.8 and 3.9. Check the online documentation at
https://docs.python.org to find the changes.
The interpreter continues prompting for Python expressions, evaluating them,
and printing their values until you ask it to stop. The Python interpreter
prompts for expressions using >>>. If you want to terminate the interpreter and
you’re using an IDE, you typically quit the IDE application. For interpreters
launched in a command-line interface, you can press Ctrl-D or sometimes Ctrl-
C to exit the Python interpreter. In this book, we show all of the Python
examples being launched from a command line, with a command that starts
with $ python3.
In Listing 1-1, you can see that simple arithmetic expressions produce results
like other programming languages. What might be less obvious is that small
integers and very large integers (bigger than what fits in 32 or 64 bits of data)
can be calculated and used just like smaller integers. For example, look at the
result of the expression 10**27 + 1. Note that these big integers are not the
same as floating-point numbers. When adding integers and floating-point
numbers as in 10**27 + 1.0001, the big integer is converted to floating-point
representation. Because floating-point numbers only have enough precision for
a fixed number of decimal places, the result is rounded to 1e+27 or 1 × 1027.
Whitespace syntax is important even when using the Python interpreter
interactively. Nested expressions use indentation instead of a visible character
to enclose the expressions that are evaluated conditionally. For example,
Python if statements demarcate the then-expression and the else-expression
by indentation. In C++ and JavaScript, you could write

if (x / 2 == 1) {do_two(x)}
else {do_other(x)}

The curly braces enclose the two expressions. In Python, you would write
if x / 2 == 1:
do_two(x)
else:
do_other(x)

You must indent the two procedure call lines for the interpreter to recognize
their relation to the line before it. You must be consistent in the indentation,
using the same tabs or spaces, on each indented line for the interpreter to know
the nested expressions are at the same level. Think of the indentation changes
as replacements for the open curly brace and the close curly brace. When the
indent increases, it’s a left brace. When it decreases, it is a right brace.
When you enter the preceding expression interactively, the Python interpreter
prompts for additional lines with the ellipsis prompt (…). These prompts
continue until you enter an empty line to signal the end of the top-level
expression. The transcript looks like this, assuming that x is 3 and the
do_other() procedure prints a message:

>>> if x / 2 == 1:
... do_two(x)
... else:
... do_other(x)
...
Processing other value
>>>

Note, if you’ve only used Python 2 before, the preceding result might surprise
you, and you should read the details of the differences between the two
versions at https://docs.python.org. To get integer division in Python 3, use the
double slash (//) operator.
Python requires that the indentation of logical lines be the same if they are at
the same level of nesting. Logical lines are complete statements or expressions.
A logical line might span multiple lines of text, such as the previous if
statement. The next logical line to be executed after the if statement’s then or
else clause should start at the same indentation as the if statement does. The
deeper indentation indicates statements that are to be executed later (as in a
function definition), conditionally (as in an else clause), repeatedly (as in a
loop), or as parts of larger construct (as in a class definition). If you have long
expressions that you would prefer to split across multiple lines, they either
• Need to be inside parentheses or one of the other bracketed expression
types (lists, tuples, sets, or dictionaries), or
• Need to terminate with the backslash character (\) in all but the last line
of the expression
Inside of parentheses/brackets, the indentation can be whatever you like
because the closing parenthesis/bracket determines where the expression ends.
When the logical line containing the expression ends, the next logical line
should be at the same level of indentation as the one just finished. The
following example shows some unusual indentation to illustrate the idea:

>>> x = 9
>>> if (x %
... 2 == 0):
... if (x %
... 3 == 0):
... ’Divisible by 6’
... else:
... ’Divisible by 2’
... else:
... if (x %
... 3 == 0):
... ’Divisible by 3’
... else:
... ’Not divisble by 2 or 3’
...
’Divisible by 3’

The tests of divisibility in the example occur within parentheses and are split
across lines in an arbitrary way. Because the parentheses are balanced, the
Python interpreter knows where the if test expressions end and doesn’t
complain about the odd indentation. The nested if statements, however, must
have the same indentation to be recognized as being at equal levels within the
conditional tests. The else clauses must be at the same indentation as the
corresponding if statement for the interpreter to recognize their relationship. If
the first else clause is omitted as in the following example,

>>> if (x %
... 2 == 0):
... if (x %
... 3 == 0):
... ’Divisible by 6’
... else:
... if (x %
... 3 == 0):
... ’Divisible by 3’
... else:
... ’Not divisble by 2 or 3’
...
’Divisible by 3’

then the indentation makes clear that the first else clause now belongs to the
if (x % 2 == 0) and not the nested if (x % 3 == 0). If x is 4, then the
statement would evaluate to None because the else clause was omitted. The
mandatory indentation makes the structure clearer, and mixing in
unconventional indentation makes the program very hard to read!
Whitespace inside of strings is important and is preserved. Simple strings are
enclosed in single (‘) or double (“) quote characters. They cannot span lines but
may contain escaped whitespace such as newline (\n) or tab (\t) characters,
e.g.,

>>> "Plank’s constant:\n quantum of action:\t6.6e-34"


"Plank’s constant:\n quantum of action:\t6.6e-34"
>>> print("Plank’s constant:\n quantum of action:\t6.6e-34")
Plank’s constant:
quantum of action: 6.6e-34

The interpreter reads the double-quoted string from the input and shows it in
printed representation form, essentially the same as the way it would be
entered in source code with the backslashes used to escape the special
whitespace. If that same double-quoted string is given to the print function, it
prints the embedded whitespace in output form. To create long strings with
many embedded newlines, you can enclose the string in triple quote characters
(either single or double quotes).

>>> """Python
... enforces readability
... using structured
... indentation.
... """
’Python\nenforces readability\nusing structured\nindentation.\n’
Long, multiline strings are especially useful as documentation strings in
function definitions.
You can add comments to the code by starting them with the pound symbol (#)
and continuing to the end of the line. Multiline comments must each have their
own pound symbol on the left. For example:

def within(x, lo, hi): # Check if x is within the [lo, hi] range
return lo <= x and x <= hi # Include hi in the range

We’ve added some color highlights to the comments and reserved words used
by Python like def, return, and and, to improve readability. We discuss the
meaning of those terms shortly. Note that comments are visible in the source
code files but not available in the runtime environment. The documentation
strings mentioned previously are attached to objects in the code, like function
definitions, and are available at runtime.

Dynamic Typing
The next most noticeable difference between Python and some other languages
is that it uses dynamic typing. That means that the data types of variables are
determined at runtime, not declared at compile time. In fact, Python doesn’t
require any variable declarations at all; simply assigning a value to variable
identifier creates the variable. You can change the value and type in later
assignments. For example,

>>> x = 2
>>> x
2
>>> x = 2.71828
>>> x
2.71828
>>> x = ’two’
>>> x
’two’

The assignment statement itself doesn’t return a value, so nothing is printed


after each assignment statement (more precisely, Python’s None value is
returned, and the interpreter does not print anything when the typed expression
evaluates to None). In Python 3.8, a new operator, :=, was introduced that
allows assignment in an expression that returns a value. For example,
evaluating

(x := 2) ** 2 + (y := 3) ** 2

sets x to be 2 and y to be 3 and returns 13 as a value.


The type of a variable’s value can be determined by the type() function or
tested using the isinstance() function.

Sequences
Arrays are different in Python than in other languages. The built-in data type
that “looks like” an array is called a list. Python’s list type is a hybrid of the
arrays and linked lists found in other languages. As with variables, the
elements of Python lists are dynamically typed, so they do not all have to be of
the same type. The maximum number of elements does not need to be declared
when creating a list, and lists can grow and shrink at runtime. What’s quite
different between Python lists and other linked list structures is that they can
be indexed like arrays to retrieve any element at any position. There is no data
type called array in the core of Python, but there is an array module that can
be imported. The array module allows for construction of arrays of fixed-
typed elements.
In this book, we make extensive use of the built-in list data type as if it were
an array. This is for convenience of syntax, and because the underlying
implementation of the list acts like arrays do in terms of indexed access to
elements. Please note, however, that we do not use all of the features that the
Python list type provides. The reason is that we want to show how fixed-type,
fixed-length arrays behave in all computer languages. For new programmers,
it’s better to use the simpler syntax that comes with the built-in list for
constructing arrays while learning how to manipulate their contents in an
algorithm.
Python’s built-in lists can be indexed using 0-relative indexes. For example:

>>> a = [1, ’a’, False]


>>> a
[1, ’a’, False]
>>> len(a)
3
>>> a[2]
False
>>> a[2] = True
>>> a
[1, ’a’, True]
>>>

The three-element list in the example contains an integer, a string, and a


Boolean value. The square brackets are used either to create a new list (as in
the first assignment to a) or to enclose the index of an existing list (as in a[2]).
The built-in len() function is used to determine the current size of its
argument. Individual values in the list can be changed using the assignment
statement. Strings can be treated like lists or arrays of characters, except that
unlike lists, strings are immutable, meaning that after a string is created, the
characters of the string cannot be changed. In Python 3, strings always contain
Unicode characters, which means there can be multiple bytes per character.

>>> s = ’π = 3.14159’
>>> s
’π = 3.14159’
>>> len(s)
11
>>> π = 3.14159
>>> π
3.14159

In the preceding example, the string, s, contains the Greek letter π, which is
counted as one character by the len() function, whereas the Unicode character
takes two bytes of space. Unicode characters can also be used in variable
names in Python 3 as shown by using π as a variable name.
Python treats all the data types that can be indexed, such as lists, arrays, and
strings, as sequence data types. The sequence data types can be sliced to form
new sequences. Slicing means creating a subsequence of the data, which is
equivalent to getting a substring for strings. Slices are specified by a start and
end index, separated by a colon (:) character. Every element from the start
index up to, but not including, the end index is copied into the new sequence.
The start index defaults to 0, the beginning of the sequence, and the end index
defaults to the length of sequence. You can use negative numbers for both array
and slice indexes. Negative indices count backwards from the end of the
sequence; −1 means the last element, −2 means the second to last element, and
so on. Here are some examples with a string:

>>> digits = ’0123456789’


>>> digits[3]
’3’
>>> digits[-1]
’9’
>>> digits[-2]
’8’
>>> digits[3:6]
’345’
>>> digits[:-2]
’01234567’

Sequence data types can be concatenated, multiplied, searched, and


enumerated. These operations sometimes require more function calls in other
languages, but Python provides simple syntax to perform them. For example:

>>> [1, 2, 3] + [’a’, ’b’]


[1, 2, 3, ’a’, ’b’]
>>> ’011’ * 7
’011011011011011011011’
>>> ’011’ * 0
’’
>>> 3 in [1, 2, 3]
True
>>> ’elm’ in [’Elm’, ’Asp’, ’Oak’]
False

The preceding example shows two lists concatenated with the plus (+)
operator to form a longer list. Multiplying a string by an integer produces that
many copies of the string, concatenated together. The in operator is a Boolean
test that searches for an element in a sequence. It uses the == equality test to
determine whether the element matches. These operations work with all
sequence data types. This compact syntax hides some of the complexity of
stepping through each sequence element and doing some operation such as
equality testing or copying the value over to a new sequence.

Looping and Iteration


Frequently we want to implement algorithms that process each of the elements
of a sequence in order. For that, Python has several ways to iterate and
enumerate sequences. For example:

>>> total = 0
>>> for x in [5, 4, 3, 2, 1]:
... total += x
...
>>> total
15

The for variable in sequence syntax is the basic loop construct (or iteration)
in Python. The nested expression is evaluated once for each value in the
sequence with the variable bound to the value. There is no need to explicitly
manipulate an index variable that points to the current element of the sequence;
that’s handled by the Python interpreter. One common mistake when trying to
enter this expression in the interactive interpreter is to forget the empty line
after the nested expression.

>>> total = 0
>>> for x in [5, 4, 3, 2, 1]:
... total += x
... total
File "<stdin>", line 3
total
^
SyntaxError: invalid syntax

The reason this is so common is that the empty line is needed only for the
interactive interpreter; the same Python expressions written in a file would not
report this as an error. The interactive interpreter, however, waits for the empty
line to signal the end of the for loop and begin evaluation of that full
expression. When the interpreter finds a new expression starting at the same
indent level as the for loop, it is dealing with two consecutive expressions and
does not allow it. The interpreter expects to read one expression, evaluate it,
and print the value, before starting to determine where the next expression
begins and ends.
In some circumstances, having an explicit index variable is important. In those
cases, there are a couple of convenient ways to perform the work. For example:
>>> height = [5, 4, 7, 2, 3]
>>> weightedsum = 0
>>> for i in range(len(height)):
... weightedsum += i * height[i]
...
>>> weightedsum
36
>>> for i, h in enumerate(height):
... weightedsum += i * h
...
>>> weightedsum
72

The example calculates a weighted sum where we multiply each value in the
height list by the index of that value. The range() function can be thought of
as a function that produces a list of integers starting at 0 and going up to, but
not equal to, its argument. By passing len(height) as an argument, range()
produces the list [0, 1, 2, 3, 4]. In the body of the first for loop, the
weightedsum variable is incremented by the product of the index, i, and the
value that i indexes in the height list. The second for loop repeats the same
calculation using a slightly more concise form called enumeration. The
enumerate() function can be thought of as taking a sequence as input and
producing a sequence of pairs. The first element of each pair is an index, and
the second is the corresponding value from its sequence argument. The second
for loop has two variables separated by a comma, i and h, instead of just one
in the previous loops. On each iteration of the enumerate loop, i is bound to
the index and h is bound to the corresponding value from height. Python
makes the common pattern of looping over a sequence very easy to write, both
with or without an index variable.
The range() and enumerate() functions actually create iterators, which are
complex data types that get called in each loop iteration to get the next value of
the sequence. It doesn’t actually produce a list in memory for the full sequence.
We discuss how iterators can be used to represent very long sequences without
taking up much memory in Chapter 5, “Linked Lists.”

Multivalued Assignment
The comma-separated list of variables can also be used in assignment
statements to perform multiple assignments with a single equal sign (=)
Another Random Document on
Scribd Without Any Related Topics
The Project Gutenberg eBook of Sixty Years in
Southern California, 1853-1913
This ebook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this ebook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

Title: Sixty Years in Southern California, 1853-1913

Author: Harris Newmark

Contributor: J. Perry Worden

Editor: Marco Ross Newmark


Maurice Harris Newmark

Release date: May 10, 2013 [eBook #42680]


Most recently updated: October 23, 2024

Language: English

Credits: Produced by Melissa McDaniel and the Online


Distributed
Proofreading Team at http://www.pgdp.net (This file
was
produced from images generously made available by
The
Internet Archive)

*** START OF THE PROJECT GUTENBERG EBOOK SIXTY YEARS IN


SOUTHERN CALIFORNIA, 1853-1913 ***
Transcriber's Note:
Obvious typographical errors have been corrected.
Inconsistent spelling and hyphenation in the original
document have been preserved.
The book uses both Phillippi and Phillipi.
Harris Newmark
Eng. by E. G. Williams & Bro. N. Y.
SIXTY YEARS

IN

SOUTHERN CALIFORNIA

1853-1913

CONTAINING THE REMINISCENCES OF

HARRIS NEWMARK

EDITED BY

MAURICE H. NEWMARK
MARCO R. NEWMARK

Every generation enjoys the use of a vast hoard bequeathed to it by


antiquity, and transmits that hoard, augmented by fresh acquisitions,
to future ages. In these pursuits, therefore, the first speculators lie
under great disadvantages, and, even when they fail, are entitled to
praise.—Macaulay.
WITH 150 ILLUSTRATIONS

NEW YORK
The Knickerbocker Press
1916

Copyright, 1916
by
M. H. and M. R. NEWMARK

To

THE MEMORY OF

MY WIFE

In Memoriam
At the hour of high twelve on April the fourth, 1916, the sun shone
into a room where lay the temporal abode, for eighty-one years and
more, of the spirit of Harris Newmark. On his face still lingered that
look of peace which betokens a life worthily used and gently
relinquished.
Many were the duties allotted him in his pilgrimage; splendidly did
he accomplish them! Providence permitted him the completion of his
final task—a labor of love—but denied him the privilege of seeing it
given to the community of his adoption.
To him and to her, by whose side he sleeps, may it be both
monument and epitaph.
Thy will be done!
M. H. N.
M. R. N.
INTRODUCTION

Several times during his latter years my friend, Charles Dwight


Willard, urged me to write out my recollections of the five or six
decades I had already passed in Los Angeles, expressing his regret
that many pioneers had carried from this world so much that might
have been of interest to both the Angeleño of the present and the
future historian of Southern California; but as I had always led an
active life of business or travel, and had neither fitted myself for any
sort of literary undertaking nor attempted one, I gave scant
attention to the proposal. Mr. Willard's persistency, however,
together with the prospect of coöperation offered me by my sons,
finally overcame my reluctance and I determined to commence the
work.
Accordingly in June, 1913, at my Santa Monica home, I began to
devote a few hours each day to a more or less fragmentary
enumeration of the incidents of my boyhood; of my voyage over the
great wastes of sea and land between my ancestral and adopted
homes; of the pueblo and its surroundings that I found on this
Western shore; of its people and their customs; and, finally, of the
men and women who, from then until now, have contributed to the
greatness of the Southland, and of the things they have done or said
to entitle their names to be recorded. This task I finished in the early
fall. During its progress I entered more and more into the distant
Past, until Memory conjured before me many long-forgotten faces
and happenings. In the end, I found that I had jotted down a mass
of notes much greater than I had expected.
Thereupon the Editors began their duties, which were to arrange the
materials at hand, to supply names and dates that had escaped me,
and to interview many who had been principals in events and,
accordingly, were presumed to know the details; and much progress
was made, to the enlarging and enrichment of the book. But it was
not long before they found that the work involved an amount of
investigation which their limited time would not permit; and that if
carried out on even the modest plan originally contemplated, some
additional assistance would be required.
Fortunately, just then they met Perry Worden, a post-graduate of
Columbia and a Doctor of Philosophy of the University of Halle,
Germany; a scholar and an author of attainments. His aid, as
investigator and adviser, has been indispensable to the completion of
the work in its present form. Dr. Worden spent many months
searching the newspapers, magazines and books—some of whose
titles find special mention in the text—which deal with Southern
California and its past; and he also interviewed many pioneers, to
each of whom I owe acknowledgment for ready and friendly
coöperation. In short, no pains was spared to confirm and amplify all
the facts and narratives.
Whether to arrange the matter chronologically or not, was a problem
impossible of solution to the complete satisfaction of the Editors;
this, as well as other methods, having its advantages and
disadvantages. After mature consideration, the chronological plan
was adopted, and the events of each year have been recorded more
or less in the order of their happening. Whatever confusion, if any,
may arise through this treatment of local history as a chronicle for
ready reference will be easily overcome, it is believed, through the
dating of the chapters and the provision of a comprehensive index;
while the brief chapter-heading, generally a reference to some
marked occurrence in that period, will further assist the reader to
get his bearings. Preference has been given to the first thirty years
of my residence in Los Angeles, both on account of my affectionate
remembrance of that time and because of the peculiarity of memory
in advanced life which enables us to recall remote events when more
recent ones are forgotten; and inasmuch as so little has been
handed down from the days of the adobe, this partiality will probably
find favor.
In collecting this mass of data, many discrepancies were met with,
calling for the acceptance or rejection of much long current here as
fact; and in all such cases I selected the version most closely
corresponding with my own recollection, or that seemed to me, in
the light of other facts, to be correct. For this reason, no less than
because in my narrative of hitherto unrecorded events and
personalities it would be miraculous if errors have not found their
way into the story, I shall be grateful if those who discover
inaccuracies will report them to me. In these sixty years, also, I have
met many men and women worthy of recollection, and it is certain
that there are some whose names I have not mentioned; if so, I
wish to disclaim any intentional neglect. Indeed, precisely as I have
introduced the names of a number for whom I have had no personal
liking, but whose services to the community I remember with
respect, so there are doubtless others whose activities, past or
present, it would afford me keen pleasure to note, but whom
unhappily I have overlooked.
With this brief introduction, I give the manuscript to the printer, not
with the ambitious hope of enriching literature in any respect, but
not without confidence that I have provided some new material for
the local historian—perhaps of the future—and that there may be a
goodly number of people sufficiently interested to read and enjoy
the story, yet indulgent enough to overlook the many faults in its
narration.
H. N.
Los Angeles, December 31, 1915.
FOREWORD

The Historian no longer writes History by warming over the


pancakes of his predecessors. He must surely know what they have
done, and how—and whereby they succeeded and wherein they
failed. But his own labor is to find the sidelights they did not have.
Macaulay saves him from doing again all the research that Macaulay
had to do; but if he could find a twin Boswell or a second Pepys he
would rather have either than a dozen new Macaulays. Since history
is becoming really a Science, and is no more a closet exploration of
half-digested arm-chair books, we are beginning to learn the
overwhelming value of the contemporary witness. Even a justice's
court will not admit Hearsay Evidence; and Science has been
shamed into adopting the same sane rule. Nowadays it demands the
eye-witness. We look less for the "Authorities" now, and more for
the Documents. There are too many histories already, such as they
are—self-satisfied and oracular, but not one conclusive. Every history
is put out of date, almost daily, by the discovery of some scrap of
paper or some clay tablet from under the ashes of Babylon.
Mere Humans no longer read History—except in school where they
have to, or in study clubs where it is also Required. But a plain
personal narrative is interesting now as it has been for five thousand
years. The world's greatest book is of course compulsory; but what
is the interesting part of it? Why, the stories—Adam and Eve;
Abraham, Isaac and Jacob; Saul and David and Samson and Delilah;
Solomon, Job, and Jesus the Christ! And if anyone thinks Moses
worked-in a little too much of the Family Tree—he doesn't know
what biblical archæology is doing. For it is thanks to these same
"petty" details that modern Science, in its excavations and
decipherings, has verified the Bible and resolved many of its riddles!
Greece had one Herodotus. America had four, antedating the year
1600. All these truly great historians built from all the "sources" they
could find. But none of them quite give us the homely, vital picture
of life and feeling that one untaught and untamed soldier, Bernal
Diaz, wrote for us three hundred years ago when he was past ninety,
and toothless—and angry "because the historians didn't get it
straight." The student of Spanish America has often to wish there
had been a Bernal Diaz for every decade and every province from
1492 to 1800. His unstudied gossip about the conquest of Mexico is
less balanced and less authoritative, but far more illuminative, than
the classics of his leader, Cortez—a university man, as well as a
great conqueror.
For more than a quarter of a century it was one of my duties to
study and review (for the Nation and other critical journals) all sorts
of local chronicles all over Spanish and English America—particularly
of frontier times. In this work I have read searchingly many
hundreds of volumes; and have been brought into close contact with
our greatest students and editors of "History-Material," and with
their standards.
I have read no other such book with so unflagging interest and
content as these memoirs of Harris Newmark. My personal
acquaintance with Southern California for more than thirty years
may color my interest in names and incidents; but I am appraising
this book (whose proofs I have been permitted to read thoroughly)
from the standpoint of the student of history anywhere. Parkman
and Fiske and Coues and Hodge and Thwaites would join me in the
wish that every American community might have so competent a
memorandum of its life and customs and growth, for its most
formative half-century.
This is not a history. It is two other much more necessary things—
for there is no such thing as a real History of Los Angeles, and
cannot be for years. These are the frank, naïve, conversational
memoirs of a man who for more than sixty years could say of
Southern California almost as truly as Æneas of his own time—"All of
which I saw, much of which I was." The keen observation, the dry
humor, the fireside intimacy of the talk, the equity and accuracy of
memory and judgment—all these make it a book which will be much
more valued by future generations of readers and students. We are
rather too near to it now.
But it is more than the "confessions" of one ripe and noble
experience. It is, beyond any reasonable comparison, the most
characteristic and accurate composite picture we have ever had of
an old, brave, human, free, and distinctive life that has changed
incredibly to the veneers of modern society. It is the very mirror of
who and what the people were that laid the real foundations for a
community which is now the wonder of the historian. The very
details which are "not Big enough" for the casual reader (mentally
over-tuned to newspaper headlines and moving pictures) are the
vital and enduring merits of this unpretentious volume. No one else
has ever set down so many of the very things that the final historian
of Los Angeles will search for, a hundred years after all our oratories
and "literary efforts" have been well forgotten. It is a chronicle
indispensable for every public library, every reference library, the
shelf of every individual concerned with the story of California.
It is the Pepys's Diary of Los Angeles and its tributary domain.
Charles F. Lummis.
PREFACE

The Editors wish to acknowledge the coöperation given, from time to


time, by many whose names, already mentioned in the text, are not
repeated here, and in particular to Drs. Leo Newmark and Charles F.
Lummis, and Joseph P. and Edwin J. Loeb, for having read the
proofs. They also wish to acknowledge Dr. Lummis's self-imposed
task of preparing the generous foreword with which this volume has
been favored. Gratitude is also due to various friends who have so
kindly permitted the use of photographs—not a few of which, never
before published, are rare and difficult to obtain. Just as in the case,
however, of those who deserve mention in these memoirs, but have
been overlooked, so it is feared that there are some who have
supplied information and yet have been forgotten. To all such, as
well as to several librarians and the following, thanks are hereby
expressed: Frederick Baker, Horace Baker, Mrs. J. A. Barrows,
Prospero Barrows, Mrs. R. C. Bartow, Miss Anna McConnell Beckley,
Sigmund Beel, Samuel Behrendt, Arthur S. Bent, Mrs. Dora
Bilderback, C. V. Boquist, Mrs. Mary Bowman, Allan Bromley,
Professor Valentin Buehner, Dr. Rose Bullard, J. O. Burns, Malcolm
Campbell, Gabe Carroll, J. W. Carson, Walter M. Castle, R. B.
Chapman, J. H. Clancy, Herman Cohn, Miss Gertrude Darlow, Ernest
Dawson and Dawson's Bookshop, Louise Deen, George E. Dimitry,
Robert Dominguez, Durell Draper, Miss Marjorie Driscoll, S. D.
Dunann, Gottlieb Eckbahl, Richard Egan, Professor Alfred Ewington,
David P. Fleming, James G. Fowler, Miss Effie Josephine Fussell, A. P.
Gibson, J. Sherman Glasscock, Gilbert H. Grosvenor, Edgar J.
Hartung, Chauncey Hayes, George H. Higbee, Joseph Hopper,
Adelbert Hornung, Walter Hotz, F. A. Howe, Dr. Clarence Edward Ide,
Luther Ingersoll, C. W. Jones, Mrs. Eleanor Brodie Jones, Reverend
Henderson Judd, D. P. Kellogg, C. G. Keyes, Willis T. Knowlton,
Bradner Lee, Jr., H. J. Lelande, Isaac Levy, Miss Ella Housefield
Lowe, Mrs. Celeste Manning, Mrs. Morris Meyberg, Miss Louisa
Meyer, William Meying, Charles E. Mitchell, R. C. Neuendorffer, S. B.
Norton, B. H. Prentice, Burr Price, Edward H. Quimby, B. B. Rich,
Edward I. Robinson, W. J. Rouse, Paul P. Royere, Louis Sainsevain,
Ludwig Schiff, R. D. Sepúlveda, Calvin Luther Severy, Miss Emily R.
Smith, Miss Harriet Steele, George F. Strobridge, Father Eugene
Sugranes, Mrs. Carrie Switzer, Walter P. Temple, W. I. Turck, Judge
and Mrs. E. P. Unangst, William M. Van Dyke, August Wackerbarth,
Mrs. J. T. Ward, Mrs. Olive E. Weston, Professor A. C. Wheat and
Charles L. Wilde.
CONTENTS

PAGE

In Memoriam v
Introduction vii
Foreword xi
Preface xv
CHAPTER

I. —Childhood and Youth, 1834-1853 1


II. —Westward, Ho! 1853 6
—New York—Nicaragua—The Golden Gate,
III. 14
1853
IV. —First Adventures in Los Angeles, 1853 27
V. —Lawyers and Courts, 1853 45
VI. —Merchants and Shops, 1853 60
VII. —In and near the Old Pueblo, 1853 80
VIII. —Round about the Plaza, 1853-1854 97
IX. —Familiar Home-Scenes, 1854 112
X. —Early Social Life, 1854 128
XI. —The Rush for Gold, 1855 146
XII. —The Great Horse Race, 1855 157
XIII. —Princely Rancho Domains, 1855 166
XIV. —Orchards and Vineyards, 1856 189
XV. —Sheriff Barton and the Bandidos, 1857 204
XVI. —Marriage—The Butterfield Stages, 1858 220
XVII. —Admission to Citizenship, 1859 240
XVIII. —First Experience with the Telegraph, 1860 260
XIX. —Steam-Wagon—Odd Characters, 1860 274
XX. —The Rumblings of War, 1861 289
XXI. —Hancock—Lady Franklin—The Deluge, 1861 299
—Droughts—The Ada Hancock Disaster, 1862-
XXII. 310
1863
XXIII. —Assassination of Lincoln, 1864-1865 328
—H. Newmark & Company—Carlisle-King Duel,
XXIV. 342
1865-1866
XXV. —Removal to New York, and Return, 1867-1868 359
XXVI. —The Cerro Gordo Mines, 1869 379
XXVII. —Coming of the Iron Horse, 1869 393
XXVIII. —The Last of the Vigilantes, 1870 408
XXIX. —The Chinese Massacre, 1871 421
XXX. —The Wool Craze, 1872-1873 437
XXXI. —The End of Vasquez, 1874 452
XXXII. —The Santa Anita Rancho, 1875 472
XXXIII. —Los Angeles & Independence Railroad, 1876 485
XXXIV. —The Southern Pacific, 1876 496
XXXV. —The Revival of the Southland, 1877-1880 509
—Centenary of the City—Electric Light, 1881-
XXXVI. 525
1884
XXXVII. —Repetto and the Lawyers, 1885-1887 546
XXXVIII. —The Great Boom, 1887 564
XXXIX. —Proposed State Division, 1888-1891 588
XL. —The First Fiestas, 1892-1897 602
—The Southwest Archæological Society, 1898-
XLI. 616
1905
XLII. —The San Francisco Earthquake, 1906-1910 633
XLIII. —Retrospection, 1910-1913 641
Index 653
ILLUSTRATIONS

FACING PAGE

Harris Newmark. In his Seventy-ninth Year


Engraved from a photograph Frontispiece
Facsimile of a Part of the MS 2
Reproduction of Swedish Advertisement 3
Philipp Neumark 10
From a Daguerreotype
Esther Neumark 10
From a Daguerreotype
J. P. Newmark 10
From a Daguerreotype
Mr. and Mrs. Joseph Newmark 10
Los Angeles in the Early Fifties 11
From a drawing of the Pacific
Railway Expedition
Bella Union as it Appeared in 1858 26
From a lithograph
John Goller's Blacksmith Shop 27
From a lithograph of 1858
Henry Mellus 50
From a Daguerreotype
Francis Mellus 50
From a Daguerreotype
John G. Downey 50
Charles L. Ducommun 50
The Plaza Church 51
From a photograph, probably taken
in the middle eighties
Pio Pico 68
From an oil portrait
Juan Bandini 68
Abel Stearns 68
Isaac Williams 68
Store of Felipe Rheim 69
John Jones 102
Captain F. Morton 102
Captain and Mrs. J. S. Garcia 102
Captain Salisbury Haley 102
El Palacio, Home of Abel and Arcadia Stearns 103
From a photograph of the seventies
The Lugo Ranch-house, in the Nineties 103
J. P. Newmark 112
From a vignette of the sixties
Jacob Rich 112
O. W. Childs 112
John O. Wheeler 112
Benjamin D. Wilson 113
George Hansen 113
Dr. Obed Macy 113
Samuel C. Foy 113
Myer J. and Harris Newmark 128
From a Daguerreotype
George Carson 128
John G. Nichols 128
David W. Alexander 129
Thomas E. Rowan 129
Matthew Keller 129
Samuel Meyer 129
Louis Sainsevain 154
Manuel Dominguez 154
El Aliso, the Sainsevain Winery 154
From an old lithograph
Jacob Elias 155
John T. Lanfranco 155
J. Frank Burns 155
Henry D. Barrows 155
Maurice Kremer 168
Solomon Lazard 168
Mellus's, or Bell's Row 168
From a lithograph of 1858
William H. Workman and John King 169
Prudent Beaudry 169
James S. Mallard 169
John Behn 169
Louis Robidoux 174
Julius G. Weyse 174
John Behn 174
Louis Breer 174
William J. Brodrick 175
Isaac R. Dunkelberger 175
Frank J. Carpenter 175
Augustus Ulyard 175
Los Angeles in the Late Fifties 188
From a contemporary sketch
Myer J. Newmark 189
Edward J. C. Kewen 189
Dr. John S. Griffin 189
William C. Warren 189
Harris Newmark, when (about) Thirty-four Years Old 224
Sarah Newmark, when (about) Twenty-four Years of Age 224
Facsimile of Harris and Sarah Newmark's Wedding
225
Invitation
San Pedro Street, near Second, in the Early Seventies 254
Commercial Street, Looking East from Main, about
254
1870
View of Plaza, Showing the Reservoir 255
Old Lanfranco Block 255
Winfield Scott Hancock 290
Albert Sidney Johnston 290
Los Angeles County in 1854 291
From a contemporary map
The Morris Adobe, once Frémont's Headquarters 291
Eugene Meyer 310
Jacob A. Moerenhout 310
Frank Lecouvreur 310
Thomas D. Mott 310
Leonard J. Rose 311
H. K. S. O'Melveny 311
Remi Nadeau 311
John M. Griffith 311
Kaspare Cohn 342
M. A. Newmark 342
H. Newmark & Co.'s Store, Arcadia Block, about 1875,
343
Including (left) John Jones's Former Premises
H. Newmark & Co.'s Building, Amestoy Block, about
343
1884
Dr. Truman H. Rose 370
Andrew Glassell 370
Dr. Vincent Gelcich 370
Charles E. Miles, in Uniform of 38's 370
Facsimile of Stock Certificate, Pioneer Oil Co. 371
American Bakery, Jake Kuhrts's Building, about 1880 371
Loebau Market Place, near the House in which Harris
384
Newmark was Born
Street in Loebau, Showing (right) Remnant of ancient
384
City Wall
Robert M. Widney 385
Dr. Joseph Kurtz 385
Isaac N. Van Nuys 385
Abraham Haas 385
Phineas Banning, about 1869 400
Henri Penelon, in his Studio 400
Carreta, Earliest Mode of Transportation 401
Alameda Street Depot and Train, Los Angeles & San
401
Pedro Railroad
Henry C. G. Schaeffer 428
Lorenzo Leck 428
Henry Hammel 428
Louis Mesmer 428
John Schumacher 428
William Nordholt 428
Turnverein-Germania Building, Spring Street 429
Vasquez and his Captors 452
(Top) D. K. Smith,
William R. Rowland,
Walter E. Rodgers.
(Middle) Albert Johnson,
Greek George's Home,
G. A. Beers.
(Bottom) Emil Harris,
Tibúrcio Vasquez,
J. S. Bryant.
Greek George 453
Nicolás Martinez 453
Benjamin S. Eaton 464
Henry T. Hazard 464
Fort Street Home, Harris Newmark, Site of Blanchard
464
Hall; Joseph Newmark at the Door
Calle de los Negros (Nigger Alley), about 1870 465
Second Street, Looking East from Hill Street, Early
465
Seventies
Round House, with Main Street Entrance 476
Spring Street Entrance to Garden of Paradise 476
Temple Street, Looking West from Broadway, about
477
1870
Pico House, soon after Completion 477
William Pridham 500
Benjamin Hayes 500
Isaac Lankershim 500
Rabbi A. W. Edelman 500
Fort Street, from the Chaparral on Fort Hill 501
Antonio Franco and Mariana Coronel 520
From an oil painting in the Coronel
Collection
Fourth Street, Looking West from Main 520
Timms Landing 521
From a print of the late fifties
Santa Catalina, in the Middle Eighties 521
Main Street Looking North from Sixth, Probably in the
530
Late Seventies
High School, on Pound Cake Hill, about 1873 530
Temple Court House, after Abandonment by the County 531
First Street, Looking East from Hill 531
Spring Street, Looking North from First, about 1885 566
Cable Car, Running North on Broadway (Previously
567
Fort Street), near Second
Early Electric Car, with Conductor James Gallagher
567
(still in Service)
George W. Burton 594
Ben C. Truman 594
Charles F. Lummis 594
Charles Dwight Willard 594
Grand Avenue Residence, Harris Newmark, 1889 595
Isaias W. Hellman 616
Herman W. Hellman 616
Cameron E. Thom 616
Ygnácio Sepúlveda 616
First Santa Fé Locomotive to Enter Los Angeles 617
Main Street, Looking North, Showing First Federal
617
Building, Middle Nineties
Harris and Sarah Newmark, at Time of Golden Wedding 636
Summer Home of Harris Newmark, Santa Monica 637
Harris Newmark, at the Dedication of M. A. Newmark &
644
Co.'s Establishment, 1912
J. P. Newmark, about 1890 644
Harris Newmark Breaking Ground for the Jewish
645
Orphans' Home, November 28th, 1911

SIXTY YEARS
IN
SOUTHERN CALIFORNIA
CHAPTER I
CHILDHOOD AND YOUTH

1834-1853

I was born in Loebau, West Prussia, on the 5th of July, 1834, the son
of Philipp and Esther, née Meyer, Neumark; and I have reason to
believe that I was not a very welcome guest. My parents, who were
poor, already had five children, and the prospects of properly
supporting the sixth child were not bright. As I had put in an
appearance, however, and there was no alternative, I was admitted
with good grace into the family circle and, being the baby, soon
became the pet.
My father was born in the ancient town of Neumark; and in his
youth he was apprenticed to a dealer in boots and shoes in a
Russian village through which Napoleon Bonaparte marched on his
way to Moscow. The conqueror sent to the shop for a pair of fur
boots, and I have often heard my father tell, with modest
satisfaction, how, shortly before he visited the great fair at Nijni
Novgorod, he was selected to deliver them; how more than one
ambitious and inquisitive friend tried to purchase the privilege of
approaching the great man, and what were his impressions of the
warrior. When ushered into the august presence, he found
Bonaparte in one of his characteristic postures, standing erect, in a
meditative mood, braced against the wall, with one hand to his
forehead and the other behind his back, apparently absorbed in
deep and anxious thought.
When I was but three weeks old, my father's business affairs called
him away from home, and compelled the sacrifice of a more or less
continued absence of eight and one half years. During this period
my mother's health was very poor. Unfortunately, also, my father
was too liberal and extravagantly-inclined for his narrow
circumstances; and not being equipped to meet the conditions of the
district in which we lived and our economical necessities, we were
continually, so to speak, in financial hot water. While he was absent,
my father traveled in Sweden and Denmark, remitting regularly to
his family as much as his means would permit, yet earning for them
but a precarious living. In 1842 he again joined his family in Loebau,
making visits to Sweden and Denmark during the summer seasons
from 1843 until the middle fifties and spending the long winters at
home. Loebau was then, as now, of little commercial importance,
and until 1849, when I was fifteen years of age and had my first
introduction to the world, my life was very commonplace and
marked by little worthy of special record, unless it was the
commotion centering in the cobble-paved market-place, as a result
of the Revolution of 1848.
With the winter of 1837 had come a change in my father's plans and
enterprises. Undergoing unusually severe weather in Scandinavia, he
listened to the lure of the New World and embarked for New York,
arriving there in the very hot summer of 1838. The contrast in
climatic conditions proved most disastrous; for, although life in the
new Republic seemed both pleasing and acceptable to one of his
temperament and liberal views, illness finally compelled him to bid
America adieu.
Facsimile of a Part of the MS.
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like