Algorithm flowchart pseudocode PDF

Title Algorithm flowchart pseudocode
Author TANZEELA SHAKEEL
Course Introduction to Business
Institution University of Management and Technology
Pages 7
File Size 320.8 KB
File Type PDF
Total Downloads 32
Total Views 160

Summary

tanzeela...


Description

Al gori t hms,Fl owchart sandPseudocodes 1.Overvi ew The t er m " al gor i t hm"i s us ed f ordes c r i bi ng t he s equenc e ofac t i ons l eadi ng t ot he s ol ut i ono ft hegi venpr obl em. Thefie l dofmat hemat i c skno wnast het heor yofal gor i t hmsi sdedi c at edt ot hes t udyof t hepr oper t i es ,met hodsofr ec or di ng,t hec r eat i onofnew al gor i t hmsandt heappl i c at i on ofdi ffer ental gor i t hms . Bas i cr equi r ement st ot heal gor i t hmsus edi nc omput ers c i enc ear et hef ol l o wi ng:    

 

Di s c r e t e ne s s :t heal gor i t hm s houl dl eadt ot hes ol ut i onoft heas s i gnedpr obl em, i nt r oduc i ngt hes ol ut i onoft hepr obl em asas equenc eofac t i ons . Fi ni t e ne s s :t henumberofs t epsoft heal gor i t hm mus tbefini t e . Effic i e nc y :t heal gor i t hm mus tbes uc ht hatas ol ut i onc oul dbef oundi nafini t e andr eas onabl et i me . Ce r t ai nt y ( or pr ec i s i on, de t er mi nac y) : al gor i t hm' s s t eps have t o al l o w unambi guous i nt er pr et at i on.Eac h al gor i t hm has t o be de vi s ed f or a c er t ai n per f or mer .I n or dert hatt heper f or merc oul ds ol vet hepr obl em ac c or di ngt ot he gi venal gor i t hm,i ti snec es s ar yt hati twoul dbeabl et ounder s t andandper f or m eac h ac t i on i ns t r uc t ed by t heal gor i t hm.Anyac t i on oft heal gor i t hm mus tbe s t r i c t l ydefinedanddes c r i bedi neac hc as e. Effe c t i ve ne s s :t heal gor i t hm mus tpr oduc ec onc r e t er es ul t s .Mor eo ver ,t hemes s age t hatt hepr obl em hasnos ol ut i onmeanst her es ul t . Ve r s at i l i t y:t heal gor i t hm mus tbede ve l oped s ot hati tc oul d be us ed t os ol ve s i mi l ar pr obl ems ( For e xampl e,t he r ul es ofaddi t i on and mul t i pl i c at i on of number sar es ui t abl ef oranynumber sandnotf oranys pec i ficones . ) .

Onec anout l i net hewaysofdes c r i bi ngofal gor i t hmsasf ol l o ws : 

  

Ve r bal :t hedes c r i pt i onofanal gor i t hm i sper f or medi nanor di nar yl anguage.The di s advant ageoft hi sme t hod i st hef ac tt hats uc h des c r i pt i onsar eno ts t r i c t l y f or mal i z edandwor dy .Thi swayc anc ont ai nambi gui t i es . Gr aphi c al :t hi smet hod i smor ei nt ui t i veand c ompac tc ompar ed t ot hever bal des c r i pt i on. For malal gor i t hmi cl anguage s( pr ogr ammi ng l anguages ) :t hi s way us es s t r i c t r ul esofc ons t r uc t i onofl anguagec ons t r uc t s . Ps e udoc ode :s yner gyo fal gor i t hmi cand or di nar yl anguages .Ps eudoc odec an be bas ed on nat i onall anguages ( Engl i s h,Es t oni an,Rus s i an et c . ) .Us es Engl i s h ( Es t oni an,Rus s i ane t c . ) l i kephr as est oout l i net het as k.

No w wec ons i deroneoft hef or msofagr aphi c alr epr es ent at i onofan al gor i t hm c al l ed flo wc har taswe l last hec or r es pondi ngps eudoc ode . 2.Fl owchart sandpseudocode Ther ear et woc ommonl yus edt ool st ohel pt odoc umentpr ogr am l ogi c( t heal gor i t hm) . Thes ear eflo wc har t sandps eudoc ode.Gener al l y ,flo wc har t swor kwe l lf ors mal lpr obl ems butps eudoc odei sus edf orl ar gerpr obl ems .Wewi l lus ebo t hme t hodsher e.

Fl o wc har ti s a gr aphi c alr epr es ent at i on ofan al gor i t hm as s er i es o fi nt er r e l at ed f unc t i onalbl oc ks ,eac hofwhi c hc or r es pondst ot hei mpl ement at i ononeormor eac t i ons . I n a flo wc har teac ht ypeofac t i ons( dat ai nput ,e val uat i ng e xpr es s i ons ,c hec ki ng t he c ondi t i ons ,managementoft her epet i t i onofac t i ons ,endpr oc es s i ng,e t c . )c o r r es pondst o t he geome t r i cs hape,pr es ent ed i nt he f or m ofbl oc ks ymbol .I ns i de t he bl oc kt he des c r i pt i on oft he appr opr i at e ac t i on i sgi ven.The bl oc ksar ec onnec t ed by l i nesof t r ans i t i onst hatdet er mi net heor derofi mpl ement at i onoft heac t i ons .

Gener alr ul esf orflo wc har t s :    

Al ls ymbol soft heflowc har tar ec onnec t edbyflowl i nes( not ear r o ws ) . Fl o wl i nesent ert het op oft hes ymboland exi toutt hebo t t om,e xc eptf ort he Dec i s i ons ymbol ,whi c hc anhaveflo wl i nesexi t i ngf r om t hebo t t om ort hes i des . Fl o wc har t sar edr awns oflow gener al l ygoe sf r om t opt obo t t om. The begi nni ng and t he end oft he flo wc har ti si ndi c at ed us i ng t he Ter mi nal s ymbol .

Al gor i t hms c an be r epr es ent ed as s ome s t r uc t ur es c ons i s t i ng of i ndi vi dual bas i c e l ement s .Nat ur al l y ,ac c or di ng t os uc h an appr oac ht oal gor i t hmst hes t udy ofbas i c pr i nc i pl esoft hei rc ons t r uc t i onmus tbegi nwi t ht hes t udyoft hes ebas i ce l ement s . Thel ogi c als t r uc t ur eofanal gor i t hm c anber epr es ent edbyc ombi nat i onoft hr eebas i c s t r uc t ur es :   

Fol l owi ng, Br anc hi ng, Loop.

1. Bas i cs t r uc t ur e" f ol l owi ng"i sal i nearal gor i t hm.I ti sf or medofas er i esofac t i ons t hatf ol l owsoneaf t ert heo t her :

Fl o wc har t :

Ps eudo c o de: Activity 1 Activity 2 Activity 3

Ver balde s c r i pt i o n: Each activity is performed one after another in sequence order.

Exampl e:Dr aw aflo wc har tf ort hi sf unc t i on:y=2x + 4x+ 3.You c an us eonl yt he oper at i onsofaddi t i onandmul t i pl i c at i on. Youc ans eet hati ti snotapr ec i s edefini t i onoft het as k.I ti snotdefinedho w wemus t c omput et hef unc t i on.Henc e,weas s umei nt hi sc as et hati ti spos s i bl et oc al c ul at et he val ueoft hef unc t i onatonc e.Ther ef or e,wec andepi c tt hef ol l o wi ngflowc har t :

2. The bas i cs t r uc t ur eof" branchi ng"i sa br anc hi ng al gor i t hm.Dependi ng on t he r es ul to ft hec hec ko fac ondi t i on ( « Yes »or« No» ) ,i tpr ovi dest hec hoi c eo neoft he al t er nat i vepat hsoft heal gor i t hm.Eac hoft hepat hwaysl eadst oac ommonout put , s ot hatt heal gor i t hm wi l lc ont i nuer egar dl es sofwhi c hpat hi sc hos en. I nt hef ol l o wi ng,weas s umet hes t r uc t ur e" br anc hi ng"exi s t si nf ourbas i cver s i ons:    

I FTHEN ( i nc ompl et ebr anc hi ng) I FTHENELSE( f ul lbr anc hi ng) SELECT( i nc ompl e t e) SELECTELSE( f ul l )

1)IF-THEN

Ps eudo c o de: IF Decision THEN Activity 1 END-IF

Ver balde s c r i pt i o n: If the Decision is true ("Yes"), the following actions(Activity 1) are performed, otherwise the transition to the next step is made at once, if any.

Thec or r e s pondi ngs ni ppe tofaflo wc har ti s :

2)IF-THEN-ELSE

Ps eudo c o de: IF Decision THEN Activity 1 ELSE Activity 2 END-IF

Ver balde s c r i pt i o n: If the Decision is true ("Yes"), the following actions (Activity 1) are performed, else ("No") the Activity 2 is performed.

Thec or r e s pondi ngs ni ppe tofaflo wc har ti s :

3)SELECT

Ps eudo c o de: SELECT CASE Decision 1: Activity 1 END-CASE CASE Decision 2: Activity 2 END-CASE CASE Decision 3: Activity 3 END-CASE ... END-SELECT

Ver balde s c r i pt i o n:

If the Decision 1 is true, then the Activity 1 actions are performed, if the Decision 2 is true, then the Activity 2 actions are performed, if the Decision 3 is true, then the Activity 3 actions are performed, ...

Thec or r e s pondi ngs ni ppe tofaflo wc har ti s :

4)SELECT-ELSE

Ps eudo c o de: SELECT CASE Decision 1: Activity 1 END-CASE CASE Decision 2: Activity 2 END-CASE CASE Decision 3: Activity 3 END-CASE ... ELSE Activity 4 END-SELECT

Aver balde s c r i pt i o ni s : If the Decision 1 is true, then the Activity 1 actions are performed, if the Decision 2 is true, then the Activity 2 actions are performed, if the Decision 3 is true, then the Activity 3 actions are performed, ... else Activity 4 actions are performed.

Thec or r e s pondi ngs ni ppe tofaflo wc har ti s :...


Similar Free PDFs