O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Everyday Data Structures

Book Description

A practical guide to learning data structures simply and easily

About This Book

  • This book is a very practical, friendly, and useful guide that will help you analyze problems and choose the right data structures for your solution
  • Learn to recognize data patterns for determining which structures apply to a given problem
  • Explore the unique rules or “gotchas” that will help you become an excellent programmer

Who This Book Is For

If you’re self-taught programmers in any language who wants to gain a solid understanding of data structures and how to use them to solve real-world problems in your day-to-day development work, then this book is for you.

What You Will Learn

  • A rapid overview of data types, applications for each type, best practices and high-level variations between platforms
  • Review the most common data structures and build working examples in the languages used for mobile platform software development
  • Understand advanced data structure concepts such as generic collections, searching and sorting algorithms, and recursion
  • Learn to use Stacks (LIFO) and queues (FIFO) in your daily application
  • Add/remove objects and nest arrays and dictionaries within another dictionary and understand why such architecture is often preferred or necessary
  • Get acquainted with the tree structures such as heap, binary, and graphs, apply them to work
  • Unleash the power of different sorting techniques such as bubble sort, quick sort, merge sort, insertion sort, and radix sort
  • Perform searching operations on arrays, heaps, graphs, and binary trees in different languages

In Detail

If you want to learn different data structures and their real-world applications quickly through practical examples, then Everyday Data Structures is for you. This book can introduce you to new data structures and their potential applications through examples in languages common to mobile software development on the most popular platforms. The examples are presented with real-world concepts using language that everyone will understand.

This book is logically divided into two parts; the first one covers the basic data structures that are built into most languages such as Objective-C, C#, Java, and Swift. It will cover detailed analysis of the common data structures such as arrays, lists, stacks, Queues, and heaps, typical applications, and specific concerns for each language. Each chapter will provide in-depth examples in several popular languages based on real-world applications.

The second part will cover more advanced data structures such as generic collections, sorting, searching, and recursion and ways to use those structures in everyday applications.

Style and approach

This is a practical, result-focused guide, which is easy to follow, but also fast-paced and really satisfying with full of examples

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Everyday Data Structures
    1. Everyday Data Structures
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Customer Feedback
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Errata
        3. Piracy
        4. Questions
    8. 1. Data Types: Foundational Structures
      1. Numeric data types
        1. Integer types
        2. Single precision float
        3. Double precision float
        4. Currency
        5. Typecasting
          1. Statically versus dynamically typed languages
          2. Implicit and explicit casting
          3. Widening and narrowing
      2. Boolean data type
        1. Operator precedence
        2. Short-circuiting
      3. Strings
      4. Summary
    9. 2. Arrays: Foundational Collections
      1. Mutable versus immutable arrays
        1. Case study: users logged in to a web service
      2. Advanced topics
        1. Linear search
        2. Primitive arrays
        3. Object arrays
        4. Mixed arrays
        5. Multidimensional arrays
        6. Jagged Arrays
      3. Summary
    10. 3. Lists: Linear Collections
      1. List implementations
        1. Array-based lists
        2. Linked list
      2. Instantiating lists
      3. Revisiting users logged in to a service
        1. Generics
        2. Case study: bike route
      4. Doubly linked list
      5. Searching
      6. A few pointers
      7. Summary
    11. 4. Stacks: LIFO Collections
      1. Initializing stacks
        1. UINavigationController
        2. Stack operations
      2. Case study: motion planning algorithm
      3. Advanced topics - stack implementations
        1. Array-based stack
        2. Linked list-based stack
      4. Summary
    12. 5. Queues: FIFO Collections
      1. Initializing queues
        1. Queue operations
      2. Case study: customer service
      3. Advanced topics
        1. Array-based queues
        2. Linked list-based queues
        3. Heap-based queues
        4. Double-ended queues
        5. Priority queues
      4. Summary
    13. 6. Dictionaries: Keyed Collections
      1. Initializing dictionaries
        1. Dictionary operations
      2. Case study: arcade ticket totals
      3. Advanced topics
        1. Hash table based dictionaries
        2. Search tree based dictionaries
      4. Summary
    14. 7. Sets: No Duplicates
      1. Set theory
      2. Initializing sets
        1. Set operations
      3. Example: revisiting users logged in to a service
        1. We would need a contract
      4. Case-study: music playlists
      5. Advanced topics
        1. Hash table-based sets
        2. Tree-based sets
        3. Array-based sets
      6. Summary
    15. 8. Structs: Complex Types
      1. The essentials
        1. C#
          1. Creating structs in C#
          2. Rule 1: The struct will logically represent a single value
          3. Rule 2: Each instance of the struct must be under 16 bytes
          4. Rule 3: The data must be immutable
          5. Rule 4: The struct will not require repeated boxing
          6. Conversion
        2. Java
        3. Objective-C
          1. Creating structs in Objective-C
        4. Swift
          1. Creating structs in Swift
      2. Enums
        1. Case study: the Metro line
      3. Summary
    16. 9. Trees: Non-Linear Structures
      1. Tree data structure versus tree data type
      2. Tree terminology
      3. Common operations
      4. Instantiating trees
      5. Tree structures
      6. Recursion
      7. Traversal
      8. Summary
    17. 10. Heaps: Ordered Trees
      1. Heap implementations
      2. Heap operations
      3. Instantiating heaps
      4. Min heap structure
      5. Common applications
      6. Summary
    18. 11. Graphs: Values with Relationships
      1. Visual graph concepts
      2. Graph operations
      3. Graph implementations
      4. The graph data structure
      5. Summary
    19. 12. Sorting: Bringing Order Out Of Chaos
      1. Selection sort
      2. Insertion sort
      3. Bubble sort
      4. Quick sort
      5. Merge sort
      6. Bucket sort
      7. Summary
    20. 13. Searching: Finding What You Need
      1. Linear search
      2. Binary search
      3. Jump search
      4. Summary