## Book description

If you know basic high-school math, you can quickly learn and apply the core concepts of computer science with this concise, hands-on book. Led by a team of experts, you’ll quickly understand the difference between computer science and computer programming, and you’ll learn how algorithms help you solve computing problems.

Each chapter builds on material introduced earlier in the book, so you can master one core building block before moving on to the next. You’ll explore fundamental topics such as loops, arrays, objects, and classes, using the easy-to-learn Ruby programming language. Then you’ll put everything together in the last chapter by programming a simple game of tic-tac-toe.

• Learn how to write algorithms to solve real-world problems
• Understand the basics of computer architecture
• Examine the basic tools of a programming language
• Explore sequential, conditional, and loop programming structures
• Understand how the array data structure organizes storage
• Use searching techniques and comparison-based sorting algorithms
• Learn about objects, including how to build your own
• Discover how objects can be created from other objects
• Manipulate files and use their data in your software

## Publisher resources

View/Submit Errata

1. Preface
2. 1. Introduction to Computer Science
1. 1.1 Introduction
2. 1.2 Application Development
3. 1.3 Algorithms
4. 1.4 Summary
5. 1.5 Exercises
3. 2. How Does the Computer Really Work?
1. 2.1 Introduction
2. 2.2 Basic Nomenclature and Components of a Computer System
3. 2.3 Scales of Magnitude
4. 2.4 Instruction Execution—Speed and Timing Scales
5. 2.5 Bit Strings and Their Meaning
6. 2.6 The Interpreter Process and Ruby
7. 2.7 Summary
8. 2.8 Exercises
4. 3. Core Programming Elements
1. 3.1 Introduction
2. 3.2 Getting Started
3. 3.3 What Is a Variable?
4. 3.4 Basic Arithmetic Operators
5. 3.5 Input and Output
6. 3.6 Common Programming Errors
7. 3.7 Mixing Data Types
8. 3.8 Summary
9. 3.9 Exercises
5. 4. Conditional Structures
1. 4.1 Introduction
2. 4.2 Flow of Execution
3. 4.3 Conditional Control
4. 4.4 If-Then-Else Statements
5. 4.5 Case Statements
6. 4.6 Debugging
7. 4.7 Summary
8. 4.8 Exercises
6. 5. Loop Structures
1. 5.1 Introduction
2. 5.2 While Loops
3. 5.3 Until Loops
4. 5.4 For Loops and Nested Loops
5. 5.5 Infinite Loops
6. 5.6 Example: Finding Prime Numbers
7. 5.7 Summary
8. 5.8 Exercises
7. 6. Arrays
1. 6.1 Introduction
2. 6.2 Array Types
3. 6.3 Hashes
4. 6.4 Summary
5. 6.5 Exercises
8. 7. Sorting and Searching
1. 7.1 Introduction
2. 7.2 Complexity Analysis
3. 7.3 Searching
4. 7.4 Summary
5. 7.5 Exercises
9. 8. Using Objects
1. 8.1 Introduction
2. 8.2 Objects and Built-in Objects
3. 8.3 Summary
4. 8.4 Exercises
10. 9. Defining Classes and Creating Objects
1. 9.1 Introduction
2. 9.2 Instantiating Objects from Classes
3. 9.3 Data and Methods
4. 9.4 Summary
5. 9.5 Exercises
11. 10. Object Inheritance
1. 10.1 Introduction
2. 10.2 Inheritance
3. 10.3 Basic Method Overriding
4. 10.4 Accessing the Superclass
5. 10.5 Applications
6. 10.6 Summary
7. 10.7 Exercises
12. 11. File Input/Output
1. 11.1 Introduction
2. 11.2 File Access: Reading and Writing
3. 11.3 Summary
4. 11.4 Exercises
13. 12. Putting It All Together: Tic-Tac-Toe