Question: PROBLEM B- Develop an algorithm to calculate the area and perimeter of different geometric shapes (rectangle, triangle, ellipse, square, circle, rhombus, trapezoid, pentagon, hexagon)

PROBLEM B- Develop an algorithm to calculate the area and perimeter of different geometric shapes (rectangle, triangle, ellipse, square, circle, rhombus, trapezoid, pentagon, hexagon) The user must provide (inputs) A. the information regarding what shape is to be analyzed B. the required geometric information (height, width,...) Required Outputs 1. name of the shape 2. the area of the shape 3. the perimeter of the shape 1. Write a program that will allow a user the opportunity to compare and analyze the efficiency of several sorting algorithms. The program will sort integer arrays of size 10, 100 and 1,000 respectively using the bubble, selection and insertion sort algorithms. The program should output in a tabular form the name of the algorithm, size of the array, number of comparisons and number of swaps. You should incorporate passing an entire array through to a function at some point in your program. The outlining of the output may look something like this: (Note: the values are fake and do not represent a real scenario) Bubble Selection Insertion Comparisons Swaps Size = 10 = 100 50 24 50 Comparisons Swaps 9 Comparisons Swaps 36 21 4950 3100 4800 2200 3150 525 = 1000 24050 6200 32000 9634 4500 1245 2. Write a program that will allow a user the opportunity to compare and analyze the efficiency of linear and sequential search algorithms. The program will search integer arrays using both binary and linear search algorithms for a key value. The arrays will be in sizes of 10, 100 and 1,000. The program should output in a tabular form the name of the algorithm, size of the array, and number of comparison. In the case of the binary search algorithm, output the number of comparisons used by to sort the array. Remember, you must first sort the array before employing the binary search algorithm. Use functions when writing the program. You should incorporate passing an entire array through to a function at some point in your program. The outlining of the output may look something like this: (Note: the values are fake and do not represent a real scenario) Binary Size = 10 Comparisons + Sorting Comparisons 2 = 100 15 = 1000 185 6 88 620 Sequential Comparisons 8 85 802
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
