Algorithms and OOD (CSC 207 2014S) : EBoards

# CSC207.01 2014S, Class 43: Hash Tables, Continued

Overview

• Preliminaries.
• Questions on the project.
• Questions on hash tables.
• Lab.

## Preliminaries

### Upcoming Work

• Reading for Friday: You may review the reading on Hash Tables. (You need not.)
• Today's writeup: Exercise 3b.
• Part 1 of the project is due tonight.
• I'll take questions after the introductory stuff.

• Yesterday's MathLAN problem solved - The lock daemon was broken.
• The longstanding MathLAN problem has not been solved.

### Extra Credit

• Convo today: Philip Deloria, Professor of History and Native American Studies, University of Michigan.
• CS extra Thursday: Charlie Eddy on Kinect.
• CS Pub Night Thursday.
• CS table Friday: Big Data (Stone leads).
• Get and wear one of the 1 in 4 shirts.
• Any other sexual assault awareness week activity.
• Iowater project April 19 - Tag drains. Mail iowater@grinnell.edu for details.
• http://www.strikingly.com/pioneerweekend

### Questions on the Project

Do we have to support top-level arrays and not just top-level objects?

Yes.

When we are handling numbers, how do we deal with the various kinds?

Option 1: Always use BigDecimal.

Option 2: Pay attention to what symbols you've seen in the number (or build the string and search for symbols). If it includes a decimal point, it's a decimal number. If not, it's an integer.

Where would you make that decision?

Probably in the parser.

Use a wrapper class. But Sam says it's up to you.

What's the performance of charAt and substring?

charAt is O(1)

I don't know the implementation of substring. I think it is O(length of resulting string), but it could be O(1)

What's the performance of "build a string by appending characters"?

O(n^2), unless you are using a StringBuffer/StringBuilder.

But you probably want to use substring instead.

Do key/value pairs appear anywhere besides in objects?

No.

## Lab

• Today's writeup: Exercise 3b.

Copyright (c) 2013-14 Samuel A. Rebelsky.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit `http://creativecommons.org/licenses/by/3.0/` or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.