Skip to Main Content
It looks like you're using Internet Explorer 11 or older. This website works best with modern browsers such as the latest versions of Chrome, Firefox, Safari, and Edge. If you continue with this browser, you may see unexpected results.
| Brooklyn College Library & Academic IT |CISC Department

CISC 3130 Data Structures: Associative Arrays

Professor Chuang Spring 2020 OER

Introduction

Definition: abstract data type storing items, or values. A value is accessed by an associated key. Basic operations are new, insert, find and delete.

References: 

Black, Paul E. (2019-10-1). Pieterse, Vreda; Black, Paul E. (eds.). "dictionary". Dictionary of Algorithms and Data Structures. National Institute of Standards and Technology. Retrieved from: https://www.nist.gov/dads/HTML/dictionary.html 

 

Concept

Associative arrays are based on a key and value pair. You use the key to look up the value.

An example use case is a symbol table, such as typing :+1: in your messages to get a thumbs up emoji or entering a key code combination into a vending machine to retrieving an item.

Key value pairs by @katychuang

Hashing is the underlying technology that the machine uses to translate the key into physical memory locations under the hood.

hashing function by @katychuang

Java Implementation

Using Java Collections Framework's HashMap class

import java.util.HashMap; // import the HashMap class
HashMap sample = new HashMap();