Draw a flowchart for the logic to count and print the total number of input records, that is, the total number of employees. Q. A population survey has been carried out in a given city, and the information received from the survey has been stored in computer, one record per citizen. That is, each record contains the name, address, sex, age, profession, etc… Of one citizen. We want to print the details of all the adults (aged 18 years or more) Finally we also want to print the total number of adults. Assume a suitable sentinel value for any field in the trailer record, and draw a flow chart for the algorithm to do this task.
Q. Each paper in a set of examination papers includes a grade of A, B, C, D or E. A mount is to be made of how many papers have the grade of A, and how many have the grade E. The total count of both types have to be printed at the end. Prepare a flowchart to perform this task. Assume a suitable sentinel value for the trailer record. Q. An employer plans to pay bonus to each employee. Those earning RSI. 2000 or above are to be paid 10 percent of their salary and those earning less than RSI. 2000 are to be paid RSI. 200. The input records contain the employee number, name, and salary of the employees.
The output to be printed should contain the employee number, name and the amount of bonus to be paid o each employee. Draw a flowchart for the algorithm to do this job. Assume a suitable sentinel value for any of the fields of the trailer record. Q. A data file contains a set of examination scores and is followed by a trailer record with a value of -1 . Draw a flowchart for the logic to calculate and print the average of the scores. Q. Five numbers denoted by the variables A, B, C, D and E are supplied as input. Draw a flowchart for the logic to print these numbers in descending order of magnitude.
Q. Draw a flowchart for the logic to find out whether a given triangle BBC is isosceles. Assume that the angles of the triangle are supplied as input. Print the answer as yes or no. Q 10. Draw a flow chart for the logic to find out whether a given quadrilateral ABACA is a rectangle. Assume that all the four angles and four sides of the quadrilateral are supplied as input data. Print the answer as yes or no. IQ 1. Draw a flow chart for the logic to convert a number to decimal from another base. For ODD Roll Number Group IQ . How does a flowchart help a programmer in a program development?
Q. Draw a flowchart of the logical steps needed to produce a printed listing of all students over the age of 20 in a class. The input records contain the name and age of the students. Assume a sentinel value of 99 for the age field of the trailer record. Q. The first 20 records in a data set are to be read and printed. Draw a flowchart for the algorithm to do this job. Make sure that the processing stops after the twentieth record. Q. For the employees problem of Question 40 ( even group Q), we want to count and print the number of only male employees in the age group of 25 to 30.
Assume that the input records contain Exceed and Age fields to provide this information. Draw a flowchart for the algorithm to perform this job. Q. A set of examination papers, which have been graded with scores form 0 to 100 is to be searched to find how many of them are above 90. The total has to be printed. Prepare a flowchart to do this job. Assume a suitable sentinel value for the trailer record. Q. A shopkeeper wants to have a general program for his personal computer, which will prepare bills for each customer as and when he sells goods to them.
His idea is that as soon as the customer purchases some goods from his shop, he will supply the description, unit price, and the quantity purchased for each item. As input to the computer. He wants hat with this information, the computer should print each item along with its unit price, quantity purchased and the total price. Finally the computer should also print the total cost of all the items purchased by the customer. Assuming a sentinel value of zero for the quantity purchased field in the trailer record, draw a flowchart for the logic to do this job.
Q. Each employee pay record includes the hours worked and the pay rate. The gross pay is to be determined as hours worked times pay rate, and is to be printed for each employee. For all hours worked in excess of 40, the overtime rate, which is 1. 5 times the regular rate, s to be paid. Draw a flowchart for the problem logic to do this. Assume a suitable sentinel value for any of the input fields of the trailer record. Q. The data file of Question 48 (even group Q) is expanded to include several sets of data, each requiring calculation of its average.
Each data set is followed by a trailer record with a value of -1; however the last data is followed by a trailer record with a value of -2. Draw a flowchart for the logic to perform this task. Q. Draw a flow chart to add up all the even numbers between O and 100. Before ending, print the result of calculation. QUO. Draw a flowchart for the OIC to find out whether a given triangle BBC is a right angled triangle. Assume that the sides are supplied as input and data. Print the answer as yes or no. IQ 1 .
Draw a flowchart for the logic to convert a number from base 10 to new base using division remainder technique. Question #2 (For all students) a) Determine which characteristics of an algorithm the following procedures have and which they lack. Procedure 1 integer) // The purpose of this procedure is to double a positive integer while n > do n an Procedure 2 choose(a, b: integers) // The purpose of this procedure is to choose a number from two positive numbers either a or b Procedure 3 sum(n:positive integer) // The purpose of this procedure is to find the sum of first 9 digits. Um = O while i < 10 do sum sum + i 1. Procedure 4 divide(n:positive integer) // The purpose of this procedure is to find the reciprocal of a positive integer n while n>= O do m l/n n n-l b) Modify above procedure so that they satisfies all the properties Question # 3 (For all students) a) Find CD(31415, 14142) by applying Culicid’s algorithm. B) Estimate how many times faster it will be to find CD(31415, 14142) by Culicid’s algorithm compared with the algorithm based on checking consecutive integers room min{m, n} down to CD(m, n). [no formal analysis required e. G. Gig Oh] Question #5 (For all students) a) What is the smallest number of divisions made by Culicid’s algorithm among all inputs 1 m, n 10? B) What is the largest number of divisions made by Culicid’s algorithm among all inputs 1 s m, n s 10? Question #6 (For all students) Culicid’s algorithm, as presented in Culicid’s treatise, uses subtractions rather than integer divisions. Write a pseudopodia for this version of Culicid’s algorithm. Question #7 (For all students) Write a pseudopodia for an algorithm for finding real roots of equation ax + box + = 0 for arbitrary real coefficients a, b, and c. You may assume the availability of the square root function sort(x). ] A Word to the Student Tell me and I will forget. Show me and I will remember. Involve me and will understand Confucius A few suggestions for learning “Design and Analysis of Algorithm. Read a few sections before each class (course outline is uploaded; you can see the section that is to be taught in class). You might not fully understand the material, but you’ll follow it far better when your instructor discusses it in class. In addition, you will be able to ask more questions in class and answer more questions.
Whenever you study the book, make sure you have a pencil and enough paper to write down definitions, theorems, and proofs, and to do the exercises. Return to review the material taught in class later in the same day. Read actively; do not just read as if it was a novel or a newspaper. Write down the definitions, theorems, and properties in your own words, without looking in your notes or the book. Good note taking and writing aid retention. Re-write the examples, proofs, and exercise done in class, all in your own words. If you find them to challenging, study them again and try again; continue until you succeed.
Always study the relevant section in the text and do the examples there; then do the exercise at the end of the section. Don’t skip steps or write over previous step; this way you will progress logically, and you can locate and correct your errors. If you can’t solve a problem because it involves a new term, formula, or some property, then re study the relevant portion of the section and try again. Don’t assume that you will be able to do every problem the first time you try it. Remember, practice is the only way to success. A Final Word Algorithm is no more difficult than any other subject.
If you have the motivation ( for motivation we will see how algorithm solve our daily life problems), and patience to learn and do the work, then you will enjoy the beauty and power of algorithm; you will see that designing an algorithm is really fun. Keep in mind that learning algorithm is a step by step process. Practice regularly and systematically; review earlier chapter/topics every week, since things must be fresh in your mind to apply and build on them. In this way, you will enjoy the subject, feel confident, and to explore more. The name of the game is practice, so practice, practice, practice.