Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Best sorting strategy for online median?

Status
Not open for further replies.

anasimtiaz

Junior Member level 1
Joined
Oct 21, 2006
Messages
19
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,283
Activity points
1,424
I'm trying to implement an online running median filter. It is supposed to give out the median value from a list of 101 elements. When a new input is available, the oldest value is dumped, newest taken and median produced. Now, initially the sorting will be expensive but once the array is sorted computational load should decrease. I have two questions here:
1) What algorithm is best for sorted or mostly sorted array?
2) Since I need to remove the oldest value, I also need to store the index of the sorted array right? Is there a better way of doing thinks.

Any pointers would be much appreciated.


Many thanks.
 

if u use bubble sort it will take O(n). On the other hand, divide and conquer algorithms like quick sort, merge sort will take O(log n) time which is comparatively quicker. and maybe u can use an array or queue to implement
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top