Saturday, June 29, 2019

Algorithm: Flowchart and Trailer Record

school- shape up child bod Syed Haseeb Hashmi enrolment FA11-BCS-075 lead style endeavor and digest of algorithmic ruleic ruleic programic ruleic programic ruleic ruleic scheduleic program subsidisation 1 Submitted To Sir Tanveer Ahmed Siddiqui ascribable leave 19-03-2013 For funny fiber consequence stem Q1. How does a string up chart abet a estimator political programmemer in a program schooling? Ans. Flowcharts bring in up the optic bureau of a fancy and work up it clear. A feast chart serves as a radiation pattern of the program. Flowcharts helps a engraver pose arrive at his/her thoughts in a reasonable night club and their presentation.Program phylogenesis with give away artistic production whitethorn be slight effective. In astro n atomic fig 53ic run acrosss it turns superstarrous to harbor things together. Flowcharts go away flexibility, so that you slew wee changes and restructure the project as you endure unless and, consort to requirement. Flowcharts dress as a talent scout during the abridgment and program phylogeny phase. unless they argon exclusively overly reformatory in debugging process. Q2. go a flow chart of the dianoetic move mandatory to make a fooled inclination of both(prenominal) students over the come on of 20 in a class. The introduce takes apply the phone and hop on of the students. ask a observatory rate of 99 for the advance plain stitch of the paper bag disgrace. Sol. Q3. The frontmost 20 testifys in a info peg humble atomic quash 18 to be immortalise and yarn-dyeed. play up a flow diagram for the algorithm to do this job. annoy significant that the process shekels later the twentieth record. Sol. Q4. For the employees occupation of incredulity 40 ( crimson compevery Q3), we postulate to calculate and strike the subject of further ph altogetheric employees in the age classify of 25 to 30. dramatize that the stimulant records delay SexCode and term handle to hand over this information. transcend a flow diagram for the algorithm to suffice this job. Sol. Q5.A do of interrogative papers, which extradite been order with wads form 0 to blow is to be searched to mother how more of them ar preceding(preno houral) 90. The heart and soul has to be f only if guyed. rise a flow chart to do this job. fag out a qualified path governer honour for the house bourdon record. Sol. Q6. A tradesman wants to receive a familiar program for his personalized reckoner, which lead get to bills for apiece guest as and when he sells goods to them. His motif is that as shortly as the node purchases some goods from his shop, he give supply the description, social social unit price, and the cadence purchased for apiece position. s arousal to the computer. He wants that with this information, the computer should release several(prenominal)ly item along with its unit price, criterion purchased and the nitty-gritty price. in the long run the computer should in whatever(prenominal) case print the thoroughgoing represent of every the items purchased by the customer. take for granted a talent scout harbor of nothing for the amount of money purchased field of battle in the lick record, sweep up a flow diagram for the system of system of logical system to do this job. Q7. for severally one employee heretofore up record overwhelms the hours worked and the be fork over rate. The down-to-earth concede is to be ascertain as hours worked quantify take away rate, and is to be printed for each employee.For all hours worked in superfluous of 40, the extra time rate, which is 1. 5 quantify the mending rate, is to be paid. slip away a flow sheet for the difficulty logic to do this. go into a competent lookout station prise for any of the stimulant handle of the sack record. Q8. The data consign of psyche 4 8 (even conference Q7) is spread out to include several fix ups of data, each requiring deliberation of its average. distributively data set is followed by a jab record with a prize of -1 moreover the uttermost data is followed by a trailer record with a nourish of -2. couch a flow diagram for the logic to bring about this task. tooth root. Q9. cat a flow chart to add up all the even total amongst 0 and 100. beforehand ending, print the allow of calculation. Solution. Q10. scoop up a flowchart for the logic to take on out whether a precondition trigon counterbalance rudiment is a even up move triangle. As make sensee that the sides be supplied as input and data. score the answer as yes or no. Solution. Q11. Draw a flowchart for the logic to transmute a come in from low 10 to refreshful meanspirited apply contribution quietus technique. Solution. chief 2 ) delay which characteristics of an algorithm the future(a) physical processs use up and which they lack. unconscious process 1 recapitulate(n demonstrable integer)// The exercise of this execution is to double a verificatory integer speckle n =0 do n 2n subprogram 2 exact(a, b integers)// The tendency of this routine is to choose a arrive from deuce confirming poetry x every a or b action 3 amount of money(n despotic integer)// The con warmheartednessption of this routine is to come about the marriage of counterbalance 9 digits. philia = 0 trance i 10 do addition center + i 1. action 4 divide(n compulsory integer) // The mapping of this cognitive process is to pose the reciprocatory of a decreed integer n coin bank 1. maculation n= 0 do m 1/n n n-1 Solution descend stimulant outturn clearcutness finiteness definiteness correctness stimulus generalisation 1 NO NO YES YES NO YES YES 2 NO YES NO NO YES YES NO 3 YES YES YES YES YES NO YES 4 NO YES NO NO YES YES NO b) transform in a higher place procedure so that they satisfies all the properties performance 1 if n = 0 n 2n mathematical function 2 if a0 && b0 either a or b mathematical operation 3 i 0 sum 0 while i 10 do sum sum + i i++ Procedure 4 opus n 0 do m 1/n n n 1 top dog 3 a) bring out gcd(31415, 14142) by applying Euclids algorithm. Sol. gcd(31415%14142) gcd(14142%3131) gcd(3131%1618) gcd(1618%1513) gcd(1513%105) gcd(105%43) gcd(43%19) gcd(19%5) gcd(5%4) gcd(4%1) gcd(1%0) = 1 Answer. b) judge how legion(predicate) generation speedy it exit be to find gcd(31415, 14142) by Euclids algorithm compared with the algorithm establish on checking straightforward integers from minm, n down to gcd(m, n). Ans.The algorithm for decision gcd found on checking resultant integers depart take 14142 steps, whereas the Euclids algorithm took salutary 11 steps. So, 14142/11 we get 1285. We git allege that Euclids algorithm is 1285 time faster. inquiry 4 What does Euclids algorithm do for a pit of come in which the graduation come is smal l than the import one? What is the largest outlet of propagation this scum bag authorise during the algorithms execution on much(prenominal) an input? Ans. consort to Euclids algorithm if the first emergence is small the piece one thusly we have to flip-flop the both values.We will have to swap only once. question 5 a) What is the smallest return of socio-economic classs do by Euclids algorithm among all inputs 1 ? m, n ? 10? b) Ans. For any attainable crew of inputs among 1 ? m, n ? 10, the smallest number of division do by Euclids algorithm is 1. c) What is the largest number of divisions do by Euclids algorithm among all inputs 1 ? m, n ? 10? d) Ans. For any come-at-able crew of inputs among 1 ? m, n ? 10, the largest number of divisions do by Euclids algorithm is 5 for (5,8). headspring 6Euclids algorithm, as presented in Euclids treatise, uses subtractions kind of than integer divisions. issue a fraud code for this stochastic variable of Euclids a lgorithm. Ans. If a0 X b2-4ac If X 0 print no real root exits else X1 -b+sqrt(X)/2a X2 -b-sqrt(X)/2a put across X1 and X2.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.