Editing Segment tree
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
− | The '''segment tree''' is a highly versatile | + | The '''segment tree''' is a highly versatile data structure, based upon the [[Divide and conquer|divide-and-conquer]] paradigm, which can be thought of as a tree of intervals of an underlying array, constructed so that queries on ranges of the array as well as modifications to the array's elements may be efficiently performed. |
− | + | kenny campbell 2c mix 106.5 baltimore http://moblogpuconro.mo.funpic.de/glass-blowing-salso.com.html peddleradvantage.com paris tn forums.on.nimp.org http://moblogpuconro.mo.funpic.de/myway.mail.html beeswax.com rubber stamp florida law section 564.09 http://moblogpuconro.mo.funpic.de/past-ms.-rodeo-america.html john wayne gacy jr www.bankof america.com worldpoints http://moblogpuconro.mo.funpic.de/lolitampegs.com-home.html auberge.relais.de.reuilly wanadoo.fr review tamron 28 80mm f 3.5 5.6 http://moblogpuconro.mo.funpic.de/w.a-componon-80mm.html u.s. made shoes.com i.v.fluids pro http://moblogpuconro.mo.funpic.de/first-night-st.-pete.html arrow delivery.com rev. luis cortes nueva.org http://moblogpuconro.mo.funpic.de/jerrod-e.-loggins.html antique chairs by h.kroher advanced auto parts.com http://moblogpuconro.mo.funpic.de/m4b-player.html matsumuras tv asahi.co.jp www.jennylopez.net index1 en.htm http://moblogpuconro.mo.funpic.de/kanto-kasei-ltd.html www.china.cn st. augustine cathederal kalamazoo http://moblogpuconro.mo.funpic.de/new-york-info-resources-attractions.ect.html media player 6.4 download | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | : | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
==Structure== | ==Structure== | ||
[[File:Segtree_92631507.png|200px|thumb|right|This segment tree.]] | [[File:Segtree_92631507.png|200px|thumb|right|This segment tree.]] | ||
− | Suppose that we use the function defined above to evaluate <math>f(1,N)</math>, where <math>N</math> is the number of elements in the array. When <math>N</math> is large, this recursive call has two "children", one of which is the recursive call <math>f | + | Suppose that we use the function defined above to evaluate <math>f(1,N)</math>, where <math>N</math> is the number of elements in the array. When <math>N</math> is large, this recursive call has two "children", one of which is the recursive call <math>f(1,\lfloor\frac{N+1}{2}\rfloor)</math>, and the other one of which is <math>f(\lfloor\frac{N+1}{2}\rfloor+1,N)</math>. Each of these children will then have two children of its own, and so on, down until the base case is reached. If we represent these recursive calls with a tree structure, the call <math>f(1,N)</math> would be the root, it would have two children, each child would have two more children, and so on; the base cases would be the leaves of the tree. We are now ready to specify the structure of the segment tree: |
* it is a binary tree which represents some underlying array; | * it is a binary tree which represents some underlying array; | ||
* each node is associated with some interval of the array and contains the value(s) of one or more functions of the elements in that interval; | * each node is associated with some interval of the array and contains the value(s) of one or more functions of the elements in that interval; |