Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.hardware > #2542

Re: NASM Programing

From Joe Beanfish <joebeanfish@nospam.duh>
Newsgroups comp.os.linux.hardware
Subject Re: NASM Programing
Date 2014-10-08 13:58 +0000
Organization A noiseless patient Spider
Message-ID <m13ftd$ob$1@dont-email.me> (permalink)
References <O9adnT4VJIiQa6nJnZ2dnUU7-U-dnZ2d@giganews.com>

Show all headers | View raw


On Wed, 08 Oct 2014 03:30:05 -0500, riverbourne14 wrote:
> Consider a sequence of 19 strictly positive decimal digits, which have
> been stored in an array.  There are obviously duplicates, and the
> sequence is unsorted.  You may use the (a priori) sequence length in
> your program.
> 
> Your job is to compute and print the _median_ of this sequence.  Since
> the sequence length is odd, the median occupies the central position
> when the sequence is sorted.
> 
> Sorting the sequence might be challenging as your first
> assembly-language program, but there is an easier way.  All you need to
> master is looping, array indexing, adding 1, and comparing.
> 
> Give yourself an auxiliary array 'count' that records the number of
> times each digit appears in the sequence.
> 
> A linear scan through the sequence is sufficient to compute 'count'.
> A second linear scan through 'count' is sufficient to compute the
> median.


Ask your prof. if he wants the median value of the numbers or the median
element of the list. They may be different. (If the above wording is that
of the prof. it sounds like you want the median element.)
Then go do your own homework.

Back to comp.os.linux.hardware | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

NASM Programing riverbourne14 <riverbourne14@gmail.com> - 2014-10-08 03:30 -0500
  Re: NASM Programing Joe Beanfish <joebeanfish@nospam.duh> - 2014-10-08 13:58 +0000

csiph-web