Objectives

Students will be able to:

  • Understand the fundamental characteristics of sets, including their unordered nature and the uniqueness of elements
  • Operations: union, intersection and difference
  • Code to check if an element is in a set, to add an element to a set, to remove an element, and to check whether one set is a subset/superset of another set

Hash Tables

 


Hash Table Contents

Log

Scenario

A large international school runs coding competitions every year.

The Head of Technology (HoT) has been assigned with creating a basic program to allow students to sign up with their school id eg "stu476".

To store the signup data, the HoT has to decide which data structure to use. Her final 3 are:

  • a static 1-dimensional array of Strings
  • a dynamic ArrayList of Strings
  • a dynamic Hash Table of Strings

She has decided to eliminate the static array. It is possible that some students will sign up and then drop out. Processing a static array when removing items can be problematic.

So, which should she choose: an ArrayList or a Hash Table?

Continue to the Worksheet activity.

Worksheet

Complete the Worksheet.

Glossary

object

property

method

create an object/instance of a class

instantiate an object

encapsulate

access

mutate

abstraction

Tags

idesyntax file class instantiate constructor type propertymethod