Ask Data Structure Expert

working with Physicists that hav an inert lattice structure, and they use this for placing charged particles at regual spacing along a straight line. Thus we can model their structure as consisting of the points 1,2,3,...,n on the real line; and at each of these points j, they have a particle with charge      \(q_i\)   (each charge can be either positive or negative). The total net force on particle j, by Coulombs Law is      i} \frac{C q_iq_j}{(j-i)^2} - \sum_{j< i} \frac{C q_iq_j}{(j-i)^2}" style="margin: 5px 0px 0px; padding: 0px; border: 0px; font-family: inherit; font-size: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; vertical-align: baseline; display: block; width: 665px;">\(F_j= \sum_{j>i} \frac{C q_iq_j}{(j-i)^2} - \sum_{j< i} \frac{C q_iq_j}{(j-i)^2}\)   .

They have written a simple program to compute Fj for all j:

For j=1,2,.....,n

      Initialize Fj to 0

For i=1,2,....,n

      if i

        Add (C qi qj)/(j-i)^2 to Fj

     else  if i>j then

         Add -(C qi qj)?(j-1)^2 to Fj

     Endif

Endfor

Output Fj

Endfor

This runs on O(n^2) time. How can we improve the algorithm to get a run time of O( n log n)?

Would you implement the divide and conquer method and use merge sort? if you do how would you do that?

Please help me figure this out, I am totally new to this and just don't grasp the concepts 100% yet.

 

 

Data Structure, Computer Science

  • Category:- Data Structure
  • Reference No.:- M9457995

Have any Question?


Related Questions in Data Structure

Data Communication Delivering Information anywhere

Topic: Data Communication Delivering Information anywhere. Write a 9-12 pages paper in which you: Present an overview of the origin and history of the concept. Describe the current use of and attitude toward the concept. ...

Problem regarding the management program

Problem: Looks like its just adding a save and load feature to the same file you sent me for python 3.5 Until now, you have had to leave your team management program running on your computer indefinitely since you did no ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As