fizzywix 0 Newbie Poster

I'm having trouble coming up with how to find the median in assembly (x86) for some beginning programs. I have an idea, but I'm thinking there must be a much more compact way to do this.

Simple algorithm for what I had in mind:
given a list and length of the list
divide length by 2, check for remainder in edx/dx
if remainder = 1 take the middle value using a pointer + 4/2/1 * median location
if remainder = 0 take the two middle values using the pointer to the list and get the average of them

I don't need code, I can do that, I'm just wondering if I am overcomplicating it and if there is a much simpler way to find such a simple measurement

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.