Hack Hour Strategy - Auxiliary Objects

Plan

  • We will discuss strategies for approaching algorithm challenges and spot when we might want to use an auxiliary object
  • We will see several challenges that can involve usage of auxiliary objects, discuss the concept behind what this auxiliary objects should keep track of, and go over their implementations

Why Auxiliary Objects?

  • Auxiliary object can be actual javascript objects, or arrays, maps, sets, etc.
  • This data structure can be used to keep track of information that is relevant to the problem at hand
  • This extra data structure can often be used to improve the time complexity of our algorithm
  • Using an auxiliary object will often result in worse space complexity as the object takes up extra space. (But usually space is cheaper than time)

Challenges

  1. removeDup
  2. union
  3. maxChar
  4. twoSum
  5. nthFibonacci