
- Data Structures & Algorithms
- DSA - Home
- DSA - Overview
- DSA - Environment Setup
- Algorithm
- DSA - Algorithms Basics
- DSA - Asymptotic Analysis
- DSA - Greedy Algorithms
- DSA - Divide and Conquer
- DSA - Dynamic Programming
- Data Structures
- DSA - Data Structure Basics
- DSA - Data Structures and Types
- DSA - Array Data Structure
- Linked Lists
- DSA - Linked List Basics
- DSA - Doubly Linked List
- DSA - Circular Linked List
- Stack & Queue
- DSA - Stack
- DSA - Expression Parsing
- DSA - Queue
- Searching Techniques
- DSA - Linear Search
- DSA - Binary Search
- DSA - Interpolation Search
- DSA - Hash Table
- Sorting Techniques
- DSA - Sorting Algorithms
- DSA - Bubble Sort
- DSA - Insertion Sort
- DSA - Selection Sort
- DSA - Merge Sort
- DSA - Shell Sort
- DSA - Quick Sort
- Graph Data Structure
- DSA - Graph Data Structure
- DSA - Depth First Traversal
- DSA - Breadth First Traversal
- Tree Data Structure
- DSA - Tree Data Structure
- DSA - Tree Traversal
- DSA - Binary Search Tree
- DSA - AVL Tree
- DSA - Red Black Trees
- DSA - B Trees
- DSA - B+ Trees
- DSA - Splay Trees
- DSA - Spanning Tree
- DSA - Tries
- DSA - Heap
- Recursion
- DSA - Recursion Basics
- DSA - Tower of Hanoi
- DSA - Fibonacci Series
- DSA Useful Resources
- DSA - Questions and Answers
- DSA - Quick Guide
- DSA - Useful Resources
- DSA - Discussion
Dictionary Operations in Data Structure
A dictionary is defined as a general-purpose data structure for storing a group of objects. A dictionary is associated with a set of keys and each key has a single associated value. When presented with a key, the dictionary will simply return the associated value.
For example, the results of a classroom test could be represented as a dictionary with student's names as keys and their scores as the values:
results = {'Anik' : 75, 'Aftab' :80, 'James' : 85, 'Manisha': 77, 'Suhana' :87, 'Margaret': 82}
Main operations of dictionaries
Dictionaries typically support so many operations −
retrieve a value (based on language, attempting to retrieve a missing key may provide a default value or throw an exception)
inserting or updating a value (typically, if the key does not exist in the dictionary, the key-value pair is inserted; if the key already exists, its corresponding value is overwritten with the new one)
remove or delete a key-value pair
test or verify for existence of a key
Most programming languages with dictionaries support iteration over the keys or values in a dictionary. Note that items in a dictionary are unordered, so loops over dictionaries will return items in random order.
- Related Articles
- Dictionary Data Structure in Javascript
- Max WBLT Operations in Data Structure
- Basic Operations for Queue in Data Structure
- A data structure for n elements and O(1) operations?
- Rectangle Data in Data Structure
- Data Dictionary in DBMS
- Explain how series data structure in Python can be created using dictionary and explicit index values?
- Quadtrees in Data Structure
- Deaps in Data Structure
- Dictionary Data Type in Python
- Operations on Queue in Data Structures
- Arrays Data Structure in Javascript
- Stack Data Structure in Javascript
- Queue Data Structure in Javascript
- Set Data Structure in Javascript
