MHB Does Algorithm Terminate when Input is not in the Finite Set?

  • Thread starter Thread starter agapito
  • Start date Start date
  • Tags Tags
    Algorithm
AI Thread Summary
The discussion centers on the concept of decidability in relation to finite sets of natural numbers. A theorem asserts that any finite set of natural numbers is effectively decidable, meaning an algorithm can determine whether a given number belongs to the set. The initial concern raised is about the algorithm's termination when checking for numbers not included in the set. Clarification reveals that for any input number, the algorithm only needs to compare it against a finite number of elements in the set. If the number is present, it may be found in fewer than the total comparisons, while if it is absent, the algorithm will complete after checking all elements, thus ensuring termination. This understanding resolves the confusion regarding the algorithm's behavior when the input number is not part of the set.
agapito
Messages
46
Reaction score
0
A theorem states: Any finite set of natural numbers is effectively decidable. I understand the construction of the (brute force) algorithm to check every input for inclusion in the set. However, if the input is not included in the set, the algorithm would not terminate, and we require algorithms to terminate. What am I missing here?
 
Technology news on Phys.org
agapito said:
A theorem states: Any finite set of natural numbers is effectively decidable. I understand the construction of the (brute force) algorithm to check every input for inclusion in the set. However, if the input is not included in the set, the algorithm would not terminate, and we require algorithms to terminate. What am I missing here?

Hi agapito, welcome to MHB, (Wave)

When you say 'a theorem states', can you please clarify which theorem you're referring to?
And when you say 'Any finite set of natural numbers is effectively decidable', can you clarify what you mean by natural numbers being decidable? As I see it, a number does not decide anything.
 
I like Serena said:
Hi agapito, welcome to MHB, (Wave)

When you say 'a theorem states', can you please clarify which theorem you're referring to?
And when you say 'Any finite set of natural numbers is effectively decidable', can you clarify what you mean by natural numbers being decidable? As I see it, a number does not decide anything.

1.- Theorem is from my textbook in section named "Effectively decidable properties and sets". I have quoted it in its entirety
2.- Decidability means that an algorithm can be constructed to check whether a given number belongs to the set.

I am unclear in the case that a number is input to the algorithm that does not belong to the set, it seems to me like the algorithm would not terminate as it's supposed to.

I certainly appreciate your help with this.
 
What ever number is given, you only need to check it against the "n" numbers in the finite set. If the number is in the set that might be determined in less than n comparisons. If the number is not in the set that will be determined in n comparisons.
 
Country Boy said:
What ever number is given, you only need to check it against the "n" numbers in the finite set. If the number is in the set that might be determined in less than n comparisons. If the number is not in the set that will be determined in n comparisons.

Many thanks for the clarification, very helpful to me. am
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top