Wednesday, March 13, 2013

Binary Search Tree



  • Binary Search Trees


• Binary Search Tree Property: The value

stored at a node is greater than the value
stored at its left child and less than the value
stored at its right child
Thus, the value stored at the root of a
subtree is greater than any value in its left
subtree and less than any value in its right
subtree!!


https://docs.google.com/viewer?a=v&q=cache:0Gua_CCn2fYJ:www.cse.unr.edu/~bebis/CS308/PowerPoint/BinarySearchTrees.ppt+&hl=en&pid=bl&srcid=ADGEESgb6XpuTDtC7ykBB3X6TzalNiMPwH4--Dw7oFhsmlz0CKzQYY0pUm1GQH6TnPqGIPWKxJRJmNvlYGyFcVmC2g7csdTN0I6vGHdlpByaLEwFrhxl_vyLNRe2ZBUWxWrbz0he_XGB&sig=AHIEtbSmEUZfU7Uxcaopi5Qoxy10g9wXTg



  • Binary Search Tree (§9.1)


A binary search tree is a binary tree storing
keys (or key-element pairs) satisfying the
following property:

Property - given a node with a value X, all the
values of nodes in the left subtree are smaller
than X and all the values of the nodes in the
right subtree are larger than X


https://docs.google.com/viewer?a=v&q=cache:yzHYvCMpV3gJ:www.cs.ucr.edu/cs14/cs14_06win/slides/BinarySearchTrees.pdf+&hl=en&pid=bl&srcid=ADGEESi5_segPdHcDjHa1xfkg_8v2ZjE0Hqp9XTQ0a_oZRS6uzr5xRhdK4dliH6Gs7WKNFQ_B6060x0vw3hGz2MfYC894jagI6gLupiucS66wDOEvcM90mhFIMDPqhp5Bsypzejh7ChF&sig=AHIEtbRXU98VmMnMNIqIlg-F1PZ592hnaA





  • Binary Search Trees


A binary search tree is a binary tree with a
special property called the BST-property,
which is given as follows:
⋆ For all nodes x and y, if y belongs to the
left subtree of x, then the key at y is less
than the key at x, and if y belongs to the
right subtree of x, then the key at y is
greater than the key at x.

https://docs.google.com/viewer?a=v&q=cache:VpSPd7v8DmQJ:www.cs.rochester.edu/~gildea/csc282/slides/C12-bst.pdf+&hl=en&pid=bl&srcid=ADGEESjjCepXiYWSyJn_c4qbmrlXw_TN7ScZWuGxkvSiLVSk4SNtl25Vu4j11wdfVnC9a18nXNn2Zu2bkeTI9RY_D9cuNlJqXjH-WAWXTXg6wOYex_KjJBGKSdwHPEdXkbufnmMFzBPK&sig=AHIEtbRCO8kKe5kt_fj8F68UIbr_iLrt-w




  • What is a binary search tree?


A binary search tree is a binary tree with the following properties:
The data stored at each node has a distinguished key which is unique in the tree and belongs to a total order. (That is, for any two non-equal keys, x,y either x < y or y < x.)
The key of any node is greater than all keys occurring in its left subtree and less than all keys occurring in its right subtree.

http://pages.cs.wisc.edu/~siff/CS367/Notes/bsts.html




  • Binary Search Trees


http://www.youtube.com/watch?v=9z8nyD5J-qE&feature=relmfu

No comments:

Post a Comment