<commit_before>// Copyright 2010 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// A Left-Leaning Red-Black (LLRB) implementation of 2-3 balanced binary search trees

package llrb

// |Tree| is a Left-Leaning Red-Black (LLRB) implementation of 2-3 trees, based on:
//
//   http://www.cs.princeton.edu/~rs/talks/LLRB/08Penn.pdf
//   http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf
//   http://www.cs.princeton.edu/~rs/talks/LLRB/Java/RedBlackBST.java
//
//  2-3 trees (and the run-time equivalent 2-3-4 trees) are the de facto standard BST
//  algoritms found in implementations of Python, Java, and other libraries. The LLRB
//  implementation of 2-3 trees is a recent improvement on the traditional implementation,
//  observed and documented by Robert Sedgewick.
//
// |Tree| has an associative interface, i.e. duplicate key are not allowed.
// The zero-value of a |Tree| represents a ready-for-use tree.
type Tree struct {
	count int
	root  *node
}

// An |Item| represents an object that can be inserted in |Tree|. It acts as a
// key via the method |LessThan|, which induces a full ordering on |Item|s. It is
// also a value, as the user can attach any data to it.
type Item interface {

	// |LessThan| returns true, if and only if |this| is STRICTLY less than |other|
	LessThan(other interface{}) bool
}

// Init resets (empties) the tree
func (t *Tree) Init() {
	t.root = nil
}

func (t *Tree) Len() int { return t.count }<commit_msg>fixed small bug in counting after a reset<commit_after>// Copyright 2010 <NAME>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// A Left-Leaning Red-Black (LLRB) implementation of 2-3 balanced binary search trees

package llrb

// |Tree| is a Left-Leaning Red-Black (LLRB) implementation of 2-3 trees, based on:
//
//   http://www.cs.princeton.edu/~rs/talks/LLRB/08Penn.pdf
//   http://www.cs.princeton.edu/~rs/talks/LLRB/LLRB.pdf
//   http://www.cs.princeton.edu/~rs/talks/LLRB/Java/RedBlackBST.java
//
//  2-3 trees (and the run-time equivalent 2-3-4 trees) are the de facto standard BST
//  algoritms found in implementations of Python, Java, and other libraries. The LLRB
//  implementation of 2-3 trees is a recent improvement on the traditional implementation,
//  observed and documented by <NAME>.
//
// |Tree| has an associative interface, i.e. duplicate key are not allowed.
// The zero-value of a |Tree| represents a ready-for-use tree.
type Tree struct {
	count int
	root  *node
}

// An |Item| represents an object that can be inserted in |Tree|. It acts as a
// key via the method |LessThan|, which induces a full ordering on |Item|s. It is
// also a value, as the user can attach any data to it.
type Item interface {

	// |LessThan| returns true, if and only if |this| is STRICTLY less than |other|
	LessThan(other interface{}) bool
}

// Init resets (empties) the tree
func (t *Tree) Init() {
	t.root = nil
	t.count = 0
}

func (t *Tree) Len() int { return t.count }
{'fraction_non_alphanumeric': 0.11502423263327949, 'fraction_numerical': 0.011308562197092083, 'mean_word_length': 3.241095890410959, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3892333', 'n_tokens_mistral': 1010, 'n_tokens_neox': 974, 'n_words': 414}