Donate SIGN UP

Discret Math

Avatar Image
AlaaAl | 06:08 Mon 30th Mar 2015 | Science
6 Answers
describe function mins that takes a non-empty of natural numbers for its argument, and has the smallest natural number in the set for its value.

i tried to use the function min which takes two integers as arguments and has the smaller of them for its value
but could not form it all together correctly :(

Help please??
Gravatar

Answers

1 to 6 of 6rss feed

Avatar Image
If you have a set {a1, a2, ... , an} of n elements then there's probably a number of ways to describe a function that finds the minimum. I'd say the simplest one to design would work as follows: 1. Compare {a1, a2} using min (which presumably finds the sign of a1-a2, but at any rate is not a difficult comparison). Label the minimum b1. 2. Compare {b1,a3} in the same...
08:44 Mon 30th Mar 2015
If you have a set {a1, a2, ... , an} of n elements then there's probably a number of ways to describe a function that finds the minimum. I'd say the simplest one to design would work as follows:

1. Compare {a1, a2} using min (which presumably finds the sign of a1-a2, but at any rate is not a difficult comparison). Label the minimum b1.
2. Compare {b1,a3} in the same way -- the new minimum can be labelled as b2.
3. And so on, until finally one compares b_(n-2) with an, finds the minimum, and labels it b_(n-1) -- which ought to be the minimum of the whole set.

I think this is the most efficient way of finding the minimum and should always work, and has the advantage of being algorithmically easy to implement for any set size. I'm not 100% sure that this is what the question was after, but it seems right to me.

If, at any point, two numbers being compared are equal, then the algorithm should arbitrarily choose the first number to enter the set {bi}.

If I've designed this algorithm correctly, then on the set {a}= {53,43,64,34,223,265,7,66,6,2} then the set {b}={43,43,34,34,34,7,7,6,2} which consists of progressively small members of the set as you go along and find new minima. Hope this helps.



Question Author
Thanks for clarifying things for me! when you break it down its seems easier.
can i ask for one more question
if i want to write down in axiomatic description
for example:
absolute value of an integer:
abs : Z →Z
∀n : Z •
n  ≤0⇒abs n = -
Question Author
absolute value of an integer:
abs : Z →Z
∀n : Z •
n  ≤0⇒abs n = -
Generally AB isn't the best place to ask a mathematics question because it doesn't support the notation needed -- as a result it looks like what you've written is incomplete and I can't follow it.
Yes alaaAl, create a file with the maths in it using some other software and provide a link to the file in an Answerbank post.

1 to 6 of 6rss feed

Do you know the answer?

Discret Math

Answer Question >>

Related Questions

Sorry, we can't find any related questions. Try using the search bar at the top of the page to search for some keywords, or choose a topic and submit your own question.