Book Image

Everyday Data Structures

By : William Smith
Book Image

Everyday Data Structures

By: William Smith

Overview of this book

Explore a new world of data structures and their applications easily with this data structures book. Written by software expert William Smith, you?ll learn how to master basic and advanced data structure concepts. ? Fully understand data structures using Java, C and other common languages ? Work through practical examples and learn real-world applications ? Get to grips with data structure problem solving using case studies
Table of Contents (20 chapters)
Everyday Data Structures
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Free Chapter
1
Data Types: Foundational Structures

Chapter 6. Dictionaries: Keyed Collections

A dictionary is an abstract data structure that can be described as a collection of keys and associated values, where each key only appears once within the collection. This associated relationship between the keys and values is why dictionaries are sometimes referred to as associative arrays. Dictionaries are also known as maps, or more specifically, hash maps for hash table-based dictionaries and tree maps for search tree-based dictionaries. The four most common functions associated with a dictionary are add, update, get, and remove. Other common operations include contains, count, reassign, and set. Each of these operations will be examined in detail later in this chapter.

The mapped, or associative, nature of dictionaries allows for extremely efficient insert, search, and update operations. By specifying the key when creating, editing, or getting a value, most operations in a well-designed dictionary have a minimal O(1) cost. Perhaps, it's because...