
The bubble sort is an inefficient, but easy-to-program, sorting technique. The idea behind the sort is to move down through an array comparing adjacent pairs and swapping the values if they are out of order. For this method to sort the array completely, it may need to pass through it many times. As the passes proceed for an ascending-order sort, the smaller elements in the array appear to rise toward the top like bubbles. Eventually, there will be a pass through the array where no swaps are required. Then, the array is sorted. After the first pass, the largest value in the array drops directly to the bottom. Consequently, the second pass only has to proceed to the second-to-last value, and so on. Develop a program to set up an array of 20 random numbers and sort them in ascending order with the bubble sort (Fig. P2.12).
FIGURE P2.12

Want to see the full answer?
Check out a sample textbook solution
Chapter 2 Solutions
Numerical Methods for Engineers
Additional Math Textbook Solutions
Math in Our World
Pathways To Math Literacy (looseleaf)
Precalculus
Precalculus: Mathematics for Calculus (Standalone Book)
Elementary and Intermediate Algebra: Concepts and Applications (7th Edition)
College Algebra (7th Edition)
- McGilla Golf has decided to sell a new line of golf clubs. The clubs will sell for $895 per set and have a variable cost of $431 per set. The company has spent $200,000 for a marketing study that determined the company will sell 80,000 sets per year for seven years. The marketing study also determined that the company will lose sales of 8,600 sets per year of its high-priced clubs. The high-priced clubs sell at $1,325 and have variable costs of $645. The company will also increase sales of its cheap clubs by 10,800 sets per year. The cheap clubs sell for $340 and have variable costs of $141 per set. The fixed costs each year will be $14,350,000. The company has also spent $1,500,000 on research and development for the new clubs. The plant and equipment required will cost $43,700,000 and will be depreciated on a straight-line basis. The new clubs will also require an increase in net working capital of $3,625,000 that will be returned at the end of the project. The tax rate is 25…arrow_forwardTri-County Utilities, Inc., supplies natural gas to customers in a three-county area. The company purchases natural gas from two companies: Southern Gas and Northwest Gas. Demand forecasts for the coming winter season are as follows: Hamilton County, 400 units; Butler County, 200 units; and Clermont County, 300 units. Contracts to provide the following quantities have been written: Southern Gas, 500 units; and Northwest Gas, 400 units. Distribution costs for the counties vary, depending upon the location of the suppliers. The distribution costs per unit (in thousands of dollars) are as follows. From To Hamilton Butler Clermont Southern Gas 10 20 15 Northwest Gas 12 15 18 (a) Develop a network representation of this problem. (Submit a file with a maximum size of 1 MB.) Choose File No file chosen Assignment 3 graph.docx Score: 1 out of 1 Comment: (b) Develop a linear programming model that can be used to determine the plan that will minimize total distribution costs (in thousands of…arrow_forwardUse the method of undetermined coefficients to solve the given nonhomogeneous system. dx dt = 2x + 3y − 8 dy dt = −x − 2y + 6 X(t) =arrow_forward
- As discussed in Section 8.3, the Markowitz model uses the variance of the portfolio as the measure of risk. However, variance includes deviations both below and above the mean return. Semivariance includes only deviations below the mean and is considered by many to be a better measure of risk. (a) Develop a model that minimizes semivariance for the Hauck Financial data given in the file HauckData with a required return of 10%. Assume that the five planning scenarios in the Hauck Financial Services model are equally likely to occur. Hint: Modify model (8.10)–(8.19). Define a variable ds for each scenario and let ds ≥ R − Rs with ds ≥ 0. Then make the objective function: Min 1 5 5 s = 1 ds2. Let FS = proportion of portfolio invested in the foreign stock mutual fund IB = proportion of portfolio invested in the intermediate-term bond fund LG = proportion of portfolio invested in the large-cap growth fund LV = proportion of portfolio invested in the large-cap value fund…arrow_forwardFor each month of the year, Taylor collected the average high temperatures in Jackson, Mississippi. He used the data to create the histogram shown. Which set of data did he use to create the histogram? A 55, 60, 64, 72, 73, 75, 77, 81, 83, 91, 91, 92\ 55,\ 60,\ 64,\ 72,\ 73,\ 75,\ 77,\ 81,\ 83,\ 91,\ 91,\ 92 55, 60, 64, 72, 73, 75, 77, 81, 83, 91, 91, 92 B 55, 57, 60, 65, 70, 71, 78, 79, 85, 86, 88, 91\ 55,\ 57,\ 60,\ 65,\ 70,\ 71,\ 78,\ 79,\ 85,\ 86,\ 88,\ 91 55, 57, 60, 65, 70, 71, 78, 79, 85, 86, 88, 91 C 55, 60, 63, 64, 65, 71, 83, 87, 88, 88, 89, 93\ 55,\ 60,\ 63,\ 64,\ 65,\ 71,\ 83,\ 87,\ 88,\ 88,\ 89,\ 93 55, 60, 63, 64, 65, 71, 83, 87, 88, 88, 89, 93 D 55, 58, 60, 66, 68, 75, 77, 82, 86, 89, 91, 91\ 55,\ 58,\ 60,\ 66,\ 68,\ 75,\ 77,\ 82,\ 86,\ 89,\ 91,\ 91 55, 58, 60, 66, 68, 75, 77, 82, 86, 89, 91, 91arrow_forward3. Consider the polynomial equation 6-iz+7z2-iz³ +z = 0 for which the roots are 3i, -2i, -i, and i. (a) Verify the relations between this roots and the coefficients of the polynomial. (b) Find the annulus region in which the roots lie.arrow_forward
- c) Using only Laplace transforms solve the following Samuelson model given below i.e., the second order difference equation (where yt is national income): - Yt+2 6yt+1+5y₁ = 0, if y₁ = 0 for t < 0, and y₁ = 0, y₁ = 1 1-e-s You may use without proof that L-1[s(1-re-s)] = f(t) = r² for n ≤tarrow_forwardScoring: MATH 15 FILING /10 COMPARISON /10 RULER I 13 Express EMPLOYMENT PROFESSIONALS NAME: SKILLS EVALUATION TEST- Light Industrial MATH-Solve the following problems. (Feel free to use a calculator.) DATE: 1. If you were asked to load 225 boxes onto a truck, and the boxes are crated, with each crate containing nine boxes, how many crates would you need to load? 2. Imagine you live only one mile from work and you decide to walk. If you walk four miles per hour, how long will it take you to walk one mile? 3. Add 3 feet 6 inches + 8 feet 2 inches + 4 inches + 2 feet 5 inches. 4. In a grocery store, steak costs $3.85 per pound. If you buy a three-pound steak and pay for it with a $20 bill, how much change will you get? 5. Add 8 minutes 32 seconds + 37 minutes 18 seconds + 15 seconds. FILING - In the space provided, write the number of the file cabinet where the company should be filed. Example: File Cabinet #4 Elson Co. File Cabinets: 1. Aa-Bb 3. Cg-Dz 5. Ga-Hz 7. La-Md 9. Na-Oz 2. Bc-Cf…arrow_forwardIf you were asked to load 225 boxes onto a truck, and the boxes are crated, with each crate containing nine boxes, how many crates would you need to load?arrow_forwardHabitat for Humanity International is a nonprofit organization dedicated to eliminating poverty housing worldwide. Suppose the following table contains estimates of activity times (in days) involved in the construction of a house that Habitat for Humanity is building. Activity Optimistic Most Probable Pessimistic A 6 7.0 8 B 7 8.0 9 C 7 7.5 11.5 D 7 9.0 10 E 6 7.0 9 F 3 4.0 5 (a) Compute the expected activity completion times and the variance for each activity. (Round your answers to two decimal places.) Activity Expected Times A B C D E F Variance (b) An analyst determined that the critical path consists of activities B-D-F. Compute the expected project completion time and the variance of this path. (Round your answers to two decimal places.) expected project completion time variance of projection completion timearrow_forwardTo manage the production of an animated movie, Pixar Animation Studios has listed the major activities involved, the predecessor relationships, and activity times (in months). The project is completed when activities F and G are both complete. Activity Immediate Predecessor G A B CD E A A C, B C, B D, E Time 4 6 2 6 3 3 5 (a) Find the critical path. (Enter your answers as a comma-separated list.) (b) The project must be completed in 1.5 years. Do you anticipate difficulty in meeting the deadline? Explain. The critical path activities require months to complete. Thus the project ---Select--- be completed in 1.5 years.arrow_forwardTo help with preparations, a couple has devised a project network to describe the activities that must be completed by their wedding date. In addition, they have estimated the time of each activity (in weeks). Start D F B E G Activity A B C DEFGH Time 5 3 6 6 6 3 11 10 (a) Identify the critical path. (Enter your answers as a comma-separated list.) H Finish (b) How much time (in weeks) will be needed to complete this project? week(s) (c) Can activity D be delayed without delaying the entire project? If so, by how many weeks? (If the activity can not be delayed, enter 0.) week(s) (d) Can activity C be delayed without delaying the entire project? If so, by how many weeks? (If the activity can not be delayed, enter 0.) week(s) (e) What is the schedule for activity E (in weeks)? Earliest Start Latest Start Earliest Finish Latest Finish week(s) week(s) week(s) week(s)arrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
- College Algebra (MindTap Course List)AlgebraISBN:9781305652231Author:R. David Gustafson, Jeff HughesPublisher:Cengage LearningElementary Linear Algebra (MindTap Course List)AlgebraISBN:9781305658004Author:Ron LarsonPublisher:Cengage LearningLinear Algebra: A Modern IntroductionAlgebraISBN:9781285463247Author:David PoolePublisher:Cengage Learning
- Algebra: Structure And Method, Book 1AlgebraISBN:9780395977224Author:Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. ColePublisher:McDougal LittellAlgebra & Trigonometry with Analytic GeometryAlgebraISBN:9781133382119Author:SwokowskiPublisher:Cengage



