News for hackers. Stuff that matters.
Re:An interesting data structure with search time O(sqrt n) by Veedrac on Tuesday December 01, 2015 @03:19AM (#10654148)
Sure, but abcdabcd987 was evidently not suggesting using a completely general BST. That there exists a BST with the mentioned properties is sufficient to validate the claim made; that there exists a BST which does not is irrelevant.
Re:An interesting data structure with search time O(sqrt n) by skj on Tuesday December 01, 2015 @09:32AM (#10655557)
I believe your and abcdabcd987's use of the term BST is not exactly what is commonly used. A BST refers to both the data structure and the algorithm used to manage it. An RB tree is a different concept. An RB tree is a binary tree, certainly, since the term "binary tree" implies no algorithms, but it is not a "binary search tree" in its specific denotation.
Re:An interesting data structure with search time O(sqrt n) by Veedrac on Tuesday December 01, 2015 @12:05PM (#10656961)
https://en.wikipedia.org/wiki/Binary_search_tree#Types

> There are many types of binary search trees. AVL trees and red-black trees are both forms of self-balancing binary search trees.

Re:An interesting data structure with search time O(sqrt n) by hvidgaard on Wednesday December 02, 2015 @02:48AM (#10661570)
Terminology is important. A BST is what I defined. A balanced BST has an extra property, but you don't get to call a balanced BST just a BST, it only adds to confusion and unclear communication.
Re:An interesting data structure with search time O(sqrt n) by Veedrac on Wednesday December 02, 2015 @03:26AM (#10661686)
I don't agree with your use of terminology; to me "BST" is just as much a class of things as "mammal" is. I will agree though that it has added confusion.
Re:An interesting data structure with search time O(sqrt n) by hvidgaard on Wednesday December 02, 2015 @04:26AM (#10661884)
> I don't agree with your use of terminology

When you say BST the only thing you've said is that it's a binary tree structure with a property about the childrens value compared to the parent. While saying that there is certain BSTs with O(lg_2 n) searches is true, there also exists BSTs with O(n) searches.

The original claim was that:

> BTW, why not BST, for everything is O(log n)?

Which is not true. A sorted linked list is the canonical counter example. There is no confusion of terminology, it is clearly defined in algorithmic literature on search trees.

Re:An interesting data structure with search time O(sqrt n) by Veedrac on Wednesday December 02, 2015 @03:15PM (#10665499)
I generally take English sentences like that to be existential claims, rather than universal ones.

For example, if I was talking about an exciting new business plan to serve alcohol in a building and someone replied "Bars already serve drinks.", you probably wouldn't object saying that some bars don't serve drinks - that's not really the point.

I can probably concoct a counterexample, but given that most BSTs that one would actually use under that terminology are self-balancing ~O(log n) structures I am tempted to go with this. I imagine if "self-balancing BST" was used the objection might never have been raised, even though not strictly all self-balancing BSTs have all O(log n) operations.

Either way it's a semantic thing that has little to do with what BST means (we agree on that) and more to do with interpreting the ambiguities of English.

Re:An interesting data structure with search time O(sqrt n) by hvidgaard on Thursday December 03, 2015 @02:57AM (#10668413)
My point of view origins from the academic world, and the distinction absolutely matters, and it should matter in any theoretical discussion on the topic, otherwise we'll spend too much time arguing semantics, instead of just being clear.

> not strictly all self-balancing BSTs have all O(log n) operations.

You're right. You could have a self balancing tree that would simply guarantee it's height is n/2, but that entails that it's height is O(n), which, by most definitions mean that it's not self balancing. You want it to be at least O(n^c) for 0<c<1, in height.

Re:An interesting data structure with search time O(sqrt n) by Veedrac on Thursday December 03, 2015 @04:16AM (#10668645)
I'll put this under "agree to disagree". English is too vague to speak unambiguously in it all the time :P.