Skip to main content
Tweeted twitter.com/#!/StackCompSci/status/352336265787604992
edited tags
Link
Raphael
  • 72.9k
  • 30
  • 181
  • 393
edited tags
Link
Raphael
  • 72.9k
  • 30
  • 181
  • 393
added 2 characters in body
Source Link
Robert S. Barnes
  • 2.9k
  • 5
  • 24
  • 24

Given a valid binary search tree whose keys are unique real numbers, and a set of $k$ pointers to the $k$ minimum elements in the tree, will the BST property be maintained if I replace all $k$ elements with the average of the $k$ elements?

The BST property as given in Corman:

Let $x$ be a node in a binary search tree. If $y$ is a node in the left subtree of $x$, then $y.key \leq x.key$. If $y$ is a node in the right subtree of $x$, then $y.key \geq x.key$.

I've tried this with a few test cases for $k=3$ and a few different trees, and it seems to hold, but I'm not sure if it actually does and how I could prove itand how I could prove it.

Given a valid binary search tree whose keys are unique real numbers, and a set of $k$ pointers to the $k$ minimum elements in the tree, will the BST property be maintained if I replace all $k$ elements with the average of the $k$ elements?

The BST property as given in Corman:

Let $x$ be a node in a binary search tree. If $y$ is a node in the left subtree of $x$, then $y.key \leq x.key$. If $y$ is a node in the right subtree of $x$, then $y.key \geq x.key$.

I've tried this with a few test cases for $k=3$ and a few different trees, and it seems to hold, but I'm not sure if it actually does and how I could prove it.

Given a valid binary search tree whose keys are unique real numbers, and a set of $k$ pointers to the $k$ minimum elements in the tree, will the BST property be maintained if I replace all $k$ elements with the average of the $k$ elements?

The BST property as given in Corman:

Let $x$ be a node in a binary search tree. If $y$ is a node in the left subtree of $x$, then $y.key \leq x.key$. If $y$ is a node in the right subtree of $x$, then $y.key \geq x.key$.

I've tried this with a few test cases for $k=3$ and a few different trees, and it seems to hold, but I'm not sure if it actually does and how I could prove it.

deleted 41 characters in body
Source Link
Juho
  • 22.8k
  • 7
  • 62
  • 117
Loading
added 49 characters in body
Source Link
Robert S. Barnes
  • 2.9k
  • 5
  • 24
  • 24
Loading
Source Link
Robert S. Barnes
  • 2.9k
  • 5
  • 24
  • 24
Loading