Algorithms and OOD (CSC 207 2014S) : EBoards
Do we have to support top-level arrays and not just top-level objects?
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.
What advice does E-guy have?
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?
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
or send a letter to Creative Commons, 543 Howard Street, 5th Floor,
San Francisco, California, 94105, USA.