4.2.7 Dictionaries Flashcards

(4 cards)

1
Q

Define Dictionaries.

A

A collection of key-value pairs in which the key value is accessed via the associated key.
Dictionary is unordered as value is retrieved by key than position.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are some standard dictionary operations?

A
  • retrieve a value associated with a particular key
  • insert a new key-value pair into the collection
  • remove a key-value pair from the collection
  • update a value associated with a key
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How does using a key make dictionaries operate more efficiently?

A

Using a key allows direct access to items stored within the collection.
This provides much quicker access to unordered data than searching through the data set using a linear search and will also outperform a binary search.

Key-value retrieval is a technique widely used in various high-performance systems, such as caches and databases.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How to retrieve a value from the dictionary?

A

To retrieve a value, you must use the key, this will return the associated data value.
The key is used in the same way that an index is used for an array.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly