Algorithms: An Introduction
Explore the foundational concepts of algorithms and their role in problem-solving using Java. Understand how to translate step-by-step procedures into code with examples such as calculating molecular mass, and learn the differences in syntax and output when using scientific notation.
We'll cover the following...
We'll cover the following...
We have already been introduced to algorithms. We can solve any problem by breaking it down into a sequence of steps. Before writing the final code, we could write the sequence of steps in our natural language, and that is how we construct an algorithm to solve problems.
Compute molecular mass of hydrocarbon
In the following part, we will compute the number of molecules in a hydrocarbon. Notice the algorithm. That is the same for any other language, we ...