QuestionQ291

Building and testing applications

You are processing a log file with three columns: a timestamp, an account number (a string), and a transaction amount (a number). You need to efficiently calculate the total transaction amount for every unique account number.

Which data structure should you use?

  • A A linked list
  • B A hash table
  • C A two-dimensional array
  • D A comma-delimited string
Explanation

A hash table stores each account number as a key and its cumulative transaction amount as the associated value, enabling efficient lookup and update while processing each log entry.

Community Discussion

No comments yet. Be the first to start the discussion!