Hobbies And Interests
Home  >> Science & Nature >> Science

Tools Used in Algorithms

An algorithm is a predefiend sequence to solve a problem or process information in a specific way. For example, cash registers follow an algorithm to compute the amount of change to give the customer, based on the cash tendered and the price of merchandise purchased. The input and output values change, but the process remains the same. The tools used to create algorithms aren't the physical tools used to make other things. They're conceptual tools: usually logic symbols that represent a function.
  1. If, Then...

    • First, don't confuse an algorithm with a computer program. An algorithm is the sequence, logic or framework; it is the functional design of a computer program or other problem-solving sequence. Most algorithms use a number of logic statements or conditional statements that relate to computer programming environments. The most common may be the "if, then" statement.

    Logic Arrays

    • Logic statements are often used in an array or a flow chart. The first logic statement might say, "if you're given money, then make change." If you're not given money, the flow chart may direct you to do nothing. If you are, the flow chart invokes another function, beginning with, for example, "if you're given $20, subtract the amount of the sale." That's not an elegant way to solve the problem, but it's an example of how algorithms begin to take shape by defining the logical sequences you want to happen.

    Else,

    • "Else" is another component in logic statements. Some "if, then" statements return a zero value if the test they perform isn't true. For example, "if you're given $20, make change, (if you're not given money, do nothing)." The else statement gives you a contingency plan. Instead of just doing nothing, you can use it to say, "if you're given $20, make change, else ask for the specific amount of money tendered."

    Less Than, Greater Than, Equal To

    • These value symbols are often used in algorithms to conditionally direct the flow of a sequence. For example, an algorithm might say, "if the customer's bill is equal to or less than $10, do not mail the invoice; else, send the invoice." You can think of these tools as logical nodes in a sequence. At each node, any one of a variety of symbolic tools can be used to define how you want the information processed in search of your solution.


https://www.htfbw.com © Hobbies And Interests