comp.lang.ada
 help / color / mirror / Atom feed
* HELP! ADA and Binary Strings
@ 2000-03-19  0:00 j80edd
  2000-03-19  0:00 ` Robert A Duff
  0 siblings, 1 reply; 2+ messages in thread
From: j80edd @ 2000-03-19  0:00 UTC (permalink / raw)


I have an algorithm which i need to implement in ada but i am having a
little trouble with it. The problem is defined below.

INPUT: A set S of k binary strings, each of length n; a positive integer
r.
QUESTION: Is there an n-bit string y such that for every string x in S,
the Hamming distance, H(x, y) is at most r?.
COMMENTS: The Hamming distance, H(x, y), between binary strings x and y
of length n, is the number of bit positions in which x and y have
different values.

In order to calculate then hamming distance the xor opperator is used on
the two binary strings, and then the number of ones is counted. The
problem is how to hold the binary strings. Is there any way in ada to
access the binary value of a integer or character?  currently i am
trying to us an array of an array of type boolean. Any help would be
greatly appreciated.


Scott





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: HELP! ADA and Binary Strings
  2000-03-19  0:00 HELP! ADA and Binary Strings j80edd
@ 2000-03-19  0:00 ` Robert A Duff
  0 siblings, 0 replies; 2+ messages in thread
From: Robert A Duff @ 2000-03-19  0:00 UTC (permalink / raw)


j80edd <j80edd@netscapeonline.co.uk> writes:

> In order to calculate then hamming distance the xor opperator is used on
> the two binary strings, and then the number of ones is counted. The
> problem is how to hold the binary strings. Is there any way in ada to
> access the binary value of a integer or character?  currently i am
> trying to us an array of an array of type boolean. Any help would be
> greatly appreciated.

Arrays of booleans have "xor".  Look up Unchecked_Conversion and pragma
Pack.  Also, perhaps, modular types.

- Bob




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-03-19  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-03-19  0:00 HELP! ADA and Binary Strings j80edd
2000-03-19  0:00 ` Robert A Duff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox