Python Programming: The Ultimate Beginners Guide to Learn Python Machine Learning Step-by-Step by Stark Alex

Python Programming: The Ultimate Beginners Guide to Learn Python Machine Learning Step-by-Step by Stark Alex

Author:Stark, Alex [Stark, Alex]
Language: eng
Format: epub
Published: 2021-02-01T16:00:00+00:00


How Do You Start Writing an Algorithm?

An algorithm is like a recipe. You have certain ingredients that are used (data), and these ingredients are mixed in a step by step procedure (performing a task) in order to get the desired dish (outcome).

Using a recipe as an example, you are going to learn how to write an algorithm.

Step 1: The Problem

The first step is to define the problem. In this case, it is a recipe, but for what?

● You want to make a cake.

What type of cake:

● Chocolate cake.

How many cakes?

● 1

Now the problem has been defined:

● You want to make 1 chocolate cake.

It must be noted that problems in real-life situations are not as simple as above. There is a lot that goes into defining a problem. Usually, developers do not get involved at this level unless they are developing a system they want to develop for themselves.

Although most developers shy away from getting involved in defining the problem, they are always roped in. If you go back to the start of this chapter part of a characteristic of an algorithm is a “well-defined problem.”

Some of the common features of a well-defined problem should include:

● The descriptions should not be ambiguous.

● The problem should be clear and concise with no unstated presumptions.

● There should be no internal contradictions.

● The description of the problem should be complete and detailed.

Step 2: Analyze the Problem

Once the problem has been identified as a well-defined one, the programmer needs to analyze it. During this step, you need to answer questions such as:

● What kind of data is it?

● Are there rules pertaining to working with the data?

● Is the data readily available?

● Where is the data?

● What is the relationship between the data?

● What items need to be removed?

● What items need to be changed, updated, or modified?

● What are the changes, modifications, or updates?

● What is the desired outcome or end results?

Step 3: The Algorithm

● Input the ingredients (input data)

● Mix the ingredients in a certain way and put it in the oven (perform the task)

● Output the baked cake (output data)

Now that you have defined the problem and analyzed it, it is time to figure out the solution algorithm to obtain the desired outcome. But if you look at baking cakes, for example, you will see that there is more than one way to bake a cake.

As with any problem, there is usually more than one solution that can output the desired results. You can’t just take the first solution you have presented, because the second, third, or even fourth solution may be a better fit for the situation.

When designing algorithms, you will more than likely end up with a number of solution algorithms that could be suitable for the defined problem.

Step 4: Analyzing and Choosing the Best Solution Algorithm for the Problem

The best solution algorithm will depend on a number of factors, such as:

● The resources at your disposal — you can eliminate solutions that may incur extra time, effort, or resources.

●



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.