×
Log in to StudySoup
Get Full Access to Chemistry: A Molecular Approach - 3 Edition - Chapter 1 - Problem 59ae
Join StudySoup for FREE
Get Full Access to Chemistry: A Molecular Approach - 3 Edition - Chapter 1 - Problem 59ae

Already have an account? Login here
×
Reset your password

(a) Classify each of the following as a pure substance, a

Chemistry: A Molecular Approach | 3rd Edition | ISBN: 9780321809247 | Authors: Nivaldo J. Tro ISBN: 9780321809247 1

Solution for problem 59AE Chapter 1

Chemistry: A Molecular Approach | 3rd Edition

  • Textbook Solutions
  • 2901 Step-by-step solutions solved by professors and subject experts
  • Get 24/7 help from StudySoup virtual teaching assistants
Chemistry: A Molecular Approach | 3rd Edition | ISBN: 9780321809247 | Authors: Nivaldo J. Tro

Chemistry: A Molecular Approach | 3rd Edition

4 5 1 300 Reviews
19
3
Problem 59AE

(a) Classify each of the following as a pure substance, a solution, or a heterogeneous mixture: a gold coin, a cup of coffee, a wood plank, (b) What ambiguities are there in answering part (a) from the descriptions given?

Step-by-Step Solution:
Step 1 of 3

Chapter 12: Recursion  Recursion – defining an operation in terms of itself o solve a large problem by solving smaller instances of the same problem  Recursion in programming – writing methods that call themselves o a good substitute for loops  A non-programming example: find out how many people are sitting directly behind you, if you can’t see all the way to the back of the room o rather than 1 person solving the entire problem (like with a loop), each person solves a small part (recursion) o ask the person behind you if someone is sitting behind him – for everyone who answers “yes” add 1; stop when the final person answers “no”  Recursion algorithms have 2 cases: 1. Base case – simple occurrence, directly answerable. Usually when a number n = 0 or 1 2. Recursive case – not directly answerable. Can apply to any number n  Some problems will have multiple base or recursive cases. You need at least 1 of each  Example: a method that prints a line of n stars, without using loops: o Base case – if n = 0, print nothing and end output. o Recursive case – if n > 0, print a star and call the method again for n-1, over and over until n = 0 public static void printStars(int n) { if (n == 0) { //base case, n=0, ends output System.out.print(); } else { //recursive case, prints 1 more star System.out.print(“*”); printStars(n-1); //n passed to the method is decreased by 1 } } This method calls itself and prints a star for each integer from n to 1, then when n = 0 the method ends. ***I noticed that this method will result in an infinite loop if n is a negative number. It doesn’t make sense to enter a negative number, but anyway, this can be fixed by changing line 2 to: if (n <= 0) {  Here’s a trace of what happens when printStars(3); is called: printStars(3); //n>0, execute else statements System.out.print(“*”); printStars(2); //n>0, execute else statements System.out.print(“*”); printStars(1); //n>0, execute else statements System.out.print(“*”); printStars(0); //n==0, execute if statement System.out.println();  Infinite recursion – writing a method that never finishes executing (like an infinite loop – not good!) o Example: public static void writeStars(int n) { writeStars(n); }  What is the output of calling the following code mystery(648); public static int mystery(int n) { if (n < 10) { return n; } else { int a = n / 10; int b = n % 10; return mystery(a + b); } } mystery(648) // 648 > 0, execute else statements a = 64; b = 8 return mystery (72); // 72 > 0, execute else statements a = 7; b = 2 return mystery(9); // 9 < 0, execute if statement return 9.  What is the output of the following code mystery(348); public static int mystery(int n) { if (n < 10) { return (10 * n) + n; } else { int a = mystery(n / 10); int b = mystery(n % 10); return (100 * a) + b; } mystery(348); // 348 > 10, execute else statements a = mystery (348 / 10); // 34 > 10, execute else statements a = mystery(34 / 10); // 3 < 10, execute if statement return 10 * 3 +3; // a = 33 b = mystery(34 % 10); // 4 < 10, execute if statement return 10 * 4 +4; // b = 44 return (100 * 33) +44; // a = 3344 b = mystery(348 % 10); // 8 < 10, execute if statement return 10 * 8 + 8; // b = 88 return (100 * 3344) + 88;  A recursive method pow that accepts an integer base and integer exponent and returns the base raised to that exponent o Base step – any number raised to the 0 power = 1 o Multiply the base times itself exponent number of times public static int pow(int base, int exponent) { if (exponent == 0) { return 1; } else { return base * pow(base, exponent – 1); } } A trace of pow(2, 3); pow(2, 3); // 3 > 0, execute else statement return 2 * pow(2, 2); // 2 > 0, execute else statement return 2 * pow (2, 1); // 1 > 0, execute else statement return 2* pow(2, 0) // 0 == 0, execute if statement return 1; return 2; return 4; return 8;

Step 2 of 3

Chapter 1, Problem 59AE is Solved
Step 3 of 3

Textbook: Chemistry: A Molecular Approach
Edition: 3
Author: Nivaldo J. Tro
ISBN: 9780321809247

This full solution covers the following key subjects: ambiguities, answering, classify, coffee, coin. This expansive textbook survival guide covers 82 chapters, and 9454 solutions. The full step-by-step solution to problem: 59AE from chapter: 1 was answered by , our top Chemistry solution expert on 02/22/17, 04:35PM. Since the solution to 59AE from 1 chapter was answered, more than 453 students have viewed the full step-by-step answer. This textbook survival guide was created for the textbook: Chemistry: A Molecular Approach, edition: 3. The answer to “(a) Classify each of the following as a pure substance, a solution, or a heterogeneous mixture: a gold coin, a cup of coffee, a wood plank, (b) What ambiguities are there in answering part (a) from the descriptions given?” is broken down into a number of easy to follow steps, and 39 words. Chemistry: A Molecular Approach was written by and is associated to the ISBN: 9780321809247.

Other solutions

People also purchased

Related chapters

Unlock Textbook Solution

Enter your email below to unlock your verified solution to:

(a) Classify each of the following as a pure substance, a