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

  • MHB
  • Thread starter agapito
  • Start date
  • Tags
    Algorithm
In summary: Many thanks for the clarification, very helpful to me. am still unclear on the case where the number is not in the set, does the algorithm still terminate or not?
  • #1
agapito
49
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
  • #2
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.
 
  • #3
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.
 
  • #4
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.
 
  • #5
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
 

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

1. What is an algorithm?

An algorithm is a set of step-by-step instructions for solving a problem or completing a task. It is a sequence of well-defined, unambiguous instructions that lead to a desired outcome.

2. How do algorithms work?

Algorithms work by breaking down a complex problem into smaller, more manageable steps. These steps are then executed in a specific order to solve the problem. The efficiency and accuracy of an algorithm depend on the design and implementation of the individual steps.

3. What are the different types of algorithms?

There are many types of algorithms, but some common ones include search algorithms, sorting algorithms, and optimization algorithms. Search algorithms are used to find a specific item or information within a dataset. Sorting algorithms are used to arrange data in a specific order, such as alphabetical or numerical. Optimization algorithms are used to find the best solution to a problem by minimizing or maximizing a specified objective.

4. How are algorithms used in everyday life?

Algorithms are used in various ways in everyday life, such as in search engines, social media platforms, and navigation systems. They are also used in finance for stock trading and in healthcare for medical diagnosis. In addition, many daily tasks, such as making a to-do list or following a recipe, involve using algorithms.

5. What is the importance of algorithms in computer science?

Algorithms are fundamental to computer science as they are the building blocks for creating software and solving complex problems efficiently. They allow computers to process and analyze large amounts of data, make decisions, and automate tasks. Without algorithms, many of the technological advancements we have today would not be possible.

Similar threads

Back
Top