CMSC 104, Algorithms

 

Practice Problem Set ( Algorithms )

 

Definitions:

1.) An Algorithm is a finite set of unambiguous executable instructions that directs a terminating activity.

2.) A generic algorithm will work with any values for input. For example, any integer, any sentence, any set of numbers.


Problems:

  1. First solve each of the following problems.
  2. Then write an algorithm for each problem. Either English sentences OR pseudocode is acceptable.


  1. A merchant wishes to mix peanuts costing $1.50 per pound with cashews costing $4.00 per pound, obtaining 50 pounds of a mixture costing $2.40 per pound. How many pounds of each type of nut should be used?
  2. A store holding a clearance sale advertises that all prices have been discounted 20%. If a certain item is on sale for $28.00. , what was its price before the sale?

  1. It costs a toy company ( 1000. + 2x ) dollars to manufacture x Big Bertha dolls. Each doll sells for $5.00 How many dolls must be sold to make $10,000 profit?

  1. A student in a C programming course has test scores of 75, 82, 71, and 84. What score on the next test will raise the students average to 80? All tests are of equal value.

  1. A newspaper boy has 125 coins, consisting of nickels and pennies. If the total amount is $4.25 how many coins of each type does he have?
  1. The pressure acting at a certain depth in a liquid is directly proportional to the distance form the surface of the liquid to that depth. In a certain oil tank the pressure at a depth of 2 feet is 118 pounds per square foot. Find the pressure at a depth of 5 feet.
  1. A manufacturer sells a certain article to dealers at a rate of $20. each if less than 50 are ordered. If 50 or more are ordered, the price of each article is reduced 50 cents. What is the total cost of 100 units?