Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(412)

Issue 9455051: Add getMinimum, getMaximum, getPreceding and getSucceeding to SplayTree. (Closed)

Created:
8 years, 10 months ago by Anders Johnsen
Modified:
8 years, 9 months ago
CC:
reviews_dartlang.org, jjb
Visibility:
Public.

Description

Add getMinimum, getMaximum, getPreceding and getSucceeding to SplayTree. Committed: https://code.google.com/p/dart/source/detail?r=4689

Patch Set 1 #

Total comments: 6

Patch Set 2 : #

Total comments: 22

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Total comments: 3

Patch Set 6 : #

Total comments: 7

Patch Set 7 : #

Patch Set 8 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+106 lines, -16 lines) Patch
M corelib/src/implementation/splay_tree.dart View 1 2 3 4 5 6 7 7 chunks +78 lines, -13 lines 0 comments Download
M tests/corelib/src/SplayTreeTest.dart View 1 2 3 4 5 6 2 chunks +28 lines, -3 lines 0 comments Download

Messages

Total messages: 16 (0 generated)
Anders Johnsen
Hi Kasper, Any idea who I should get to review this? I'll add tests/rename if ...
8 years, 10 months ago (2012-02-24 08:50:23 UTC) #1
ngeoffray
LGTM with a few simple tests, that would visually show the outcome of these methods.
8 years, 10 months ago (2012-02-24 12:49:05 UTC) #2
sra1
DBC. I think there should be an interface for these operations, e.g OrderedMap or SortedMap. ...
8 years, 10 months ago (2012-02-24 22:21:14 UTC) #3
Anders Johnsen
Thank you all for your comments. I've updated the code, and I agree that working ...
8 years, 10 months ago (2012-02-27 06:22:27 UTC) #4
kasperl
LGTM. Not sure about the ifEmpty/ifInvalid. https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart#newcode10 corelib/src/implementation/splay_tree.dart:10: SplayTreeNode(K k, V ...
8 years, 10 months ago (2012-02-27 06:50:02 UTC) #5
Søren Gjesse
https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart#newcode245 corelib/src/implementation/splay_tree.dart:245: K firstKey([K ifEmpty]) { Why not just return null ...
8 years, 10 months ago (2012-02-27 07:53:16 UTC) #6
kasperl
https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart#newcode245 corelib/src/implementation/splay_tree.dart:245: K firstKey([K ifEmpty]) { On 2012/02/27 07:53:16, Søren Gjesse ...
8 years, 10 months ago (2012-02-27 08:53:17 UTC) #7
Anders Johnsen
Updated, with a few pending questions. Thank you! https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart#newcode10 corelib/src/implementation/splay_tree.dart:10: SplayTreeNode(K ...
8 years, 10 months ago (2012-02-27 09:06:51 UTC) #8
kasperl
https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart#newcode245 corelib/src/implementation/splay_tree.dart:245: K firstKey([K ifEmpty]) { On 2012/02/27 09:06:51, ajohnsen wrote: ...
8 years, 10 months ago (2012-02-27 09:18:45 UTC) #9
Anders Johnsen
Updated based on comments. Does this look okay for commit? https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/3002/corelib/src/implementation/splay_tree.dart#newcode245 ...
8 years, 10 months ago (2012-02-27 11:49:54 UTC) #10
kasperl
https://chromiumcodereview.appspot.com/9455051/diff/7/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/7/corelib/src/implementation/splay_tree.dart#newcode243 corelib/src/implementation/splay_tree.dart:243: K get firstKey() { I don't think these should ...
8 years, 10 months ago (2012-02-27 11:52:34 UTC) #11
Anders Johnsen
https://chromiumcodereview.appspot.com/9455051/diff/7/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/7/corelib/src/implementation/splay_tree.dart#newcode243 corelib/src/implementation/splay_tree.dart:243: K get firstKey() { On 2012/02/27 11:52:34, kasperl wrote: ...
8 years, 10 months ago (2012-02-27 11:58:50 UTC) #12
kasperl
https://chromiumcodereview.appspot.com/9455051/diff/7/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/7/corelib/src/implementation/splay_tree.dart#newcode243 corelib/src/implementation/splay_tree.dart:243: K get firstKey() { On 2012/02/27 11:58:50, ajohnsen wrote: ...
8 years, 10 months ago (2012-02-27 12:04:28 UTC) #13
sra1
lgtm https://chromiumcodereview.appspot.com/9455051/diff/8/corelib/src/implementation/splay_tree.dart File corelib/src/implementation/splay_tree.dart (right): https://chromiumcodereview.appspot.com/9455051/diff/8/corelib/src/implementation/splay_tree.dart#newcode78 corelib/src/implementation/splay_tree.dart:78: } else if (key.compareTo(current.key) > 0) { You ...
8 years, 10 months ago (2012-02-27 23:46:04 UTC) #14
Søren Gjesse
lgtm
8 years, 9 months ago (2012-02-28 07:45:30 UTC) #15
Anders Johnsen
8 years, 9 months ago (2012-02-28 12:25:17 UTC) #16
Fixed. Will commit this if there are no further comments. :)

Thank you all!

https://chromiumcodereview.appspot.com/9455051/diff/8/corelib/src/implementat...
File corelib/src/implementation/splay_tree.dart (right):

https://chromiumcodereview.appspot.com/9455051/diff/8/corelib/src/implementat...
corelib/src/implementation/splay_tree.dart:78: } else if
(key.compareTo(current.key) > 0) {
On 2012/02/27 23:46:04, sra1 wrote:
> You could improve this by caching the value returned by
> key.compareTo(current.key) in a local.
I don't expect this to be a huge improvement, but done.

https://chromiumcodereview.appspot.com/9455051/diff/8/corelib/src/implementat...
corelib/src/implementation/splay_tree.dart:241: * Get the first key in the map.
Returns [ifEmpty] if the map is empty.
On 2012/02/27 23:46:04, sra1 wrote:
> There is no ifEmpty parameter.  Since it is a key and null is not comparable,
> just fix the doc.

Ah yes, ty!

https://chromiumcodereview.appspot.com/9455051/diff/8/corelib/src/implementat...
corelib/src/implementation/splay_tree.dart:254: * Get the last key in the map.
Returns [ifEmpty] if the map is empty.
On 2012/02/27 23:46:04, sra1 wrote:
> Ditto.

Done.

Powered by Google App Engine
This is Rietveld 408576698