Checkout
checkout
view
Your Cart Your Cart: item(s)
Add to Shopping Cart
$2.19 Instant Download
Computer Science, Data Structures and Algorithms
Other

Order-statistic tree (Augmenting Data Structures)


Need help to show how to use an order-statistic tree to count the number of inversions in an array of size n in time O(n lg n).

Note that we call a pair (i,j) an inversion if i < j, but key[i] > key[j]. Thus, an increasing sequence has no inversions. A decreasing list has the maximum number of inversions, n(n-1)/2.

I believe we start by letting k be the number of inversions in the sequence.  We then create an order-statistic tree and store with each node the original index in the sequence.  

Is there anything else we store in the node and what would be the algorithm for the number of inversions?

By OTA:  Xiao Liu, MS

OTA Rating:  4.7/5

Your Price:  $2.19  (original value ~$19.95)

What's included:

  • Plain text response
  • Attachment(s):
    • OS-inversion.doc
$2.19 Download Add to Cart

Add to Shopping Cart
$2.19 Instant Download

Page generated in 0.0136 seconds

About Us ·  Contact Us ·  Samples ·  Solutions ·  Legal Terms and Conditions ·  Privacy Policy

©2008 SolutionLibrary.com

Search for Solutions About Us Samples