• No results found

algorithm,flow chart and data flow diagram

N/A
N/A
Protected

Academic year: 2021

Share "algorithm,flow chart and data flow diagram"

Copied!
28
0
0

Loading.... (view fulltext now)

Full text

(1)

3

CHAPTER

INSIDE THIS CHAPTER

32

3.1. Problem 3.5. Data Flow Diagram (DFD)

3.2. Design Flow to Solve a Problem 3.6. Text Editor

3.3. Algorithms 3.7. VI Editor 3.4. Flow Chart

Overview of Algorithm,

Flowcharts and DFD

3.

3.

3.

3.

3.1

1

1

1

1 ... PR

PR

PR

PROBLEM

PR

OBLEM

OBLEM

OBLEM

OBLEM

IMPORTANT NOTES

Problems are obstacles or undesirable situations that prevent us from getting an objective. So there is thirst to solve the problem in order to get objective.

We can classify the problems into categories : n Mathematical n Logical n Political n Social n Economical n Physical n Chemical n Engineering n Medical n Environmental DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNOWWWWW At present, we are always try to solve either Mathematical or Logical problems in every context of life.

(2)

+0)26-4

!

In the present context, we are interested in problems & solutions of ‘Mathematical’ & ‘Logical’ categories.

3.2.

3.2.

3.2.

3.2.

3.2. DESIGN FL

DESIGN FL

DESIGN FLO

DESIGN FL

DESIGN FL

O

O

O

O W T

W T

W TO SOL

W T

W T

O SOL

O SOL

O SOL

O SOLVE A PR

VE A PR

VE A PR

VE A PR

VE A PROBLEM

OBLEM

OBLEM

OBLEM

OBLEM

This explains that, you should know what you do.

What are the things that you require to do the design?

Step-by-step solution of problem in English Language or in Engish- Program-Style.

Flow Chart is a modeling tool to describe our algorithm pictorially or graphically, this is easy to understand

DFD is a modeling tool, which contains some functional/process through which data flow from one location to another location

Whatever you write in algorithm, we have to just design it using any program language like C, C++, Java, and Dotnet etc.

All the phases mentioned above are very important to understand to implement or develop software. Now in the next session we are trying to explain all these above Phases, mainly Algorithms, Flow charts & Data flow Diagram, which are very important part of the problem designing & analysis.

3.3.

3.3.

3.3.

3.3.

3.3. AL

AL

AL

ALGORITHMS

AL

GORITHMS

GORITHMS

GORITHMS

GORITHMS

A simple way of solving any problem is to make its Algorithm and flowchart.

IMPORTANT NOTES

An Algorithm is the step-by-step procedure to solve a particular problem in either in pure english language or in english programming style.

Any Algorithm can be written in any style i.e. either in English or in English programming style etc.

For Example :

To assign the values to the variables A & B using an algorithm in English Language style just write the following line :

Assign the inputs, which is obtained from user, to A & B

D E SIG N ID E A SP EC IFIC AT IO N A L G ORIT H M S F L OW C H A R T D ATA FLO W D IA G RA M IM P L EM E N TATIO N U S IN G A N Y L A N G UA GE DO YOU KNO DO YOU KNODO YOU KNO DO YOU KNODO YOU KNOWWWWW Implementation of a problem using any programming lan-guage is just weighted 20% of the complete project & the remaining 80% weightage uses the documentation part i.e. Algorithms, Flow-Charts, Data Flow Diagram.

DO YOU KNO DO YOU KNODO YOU KNO DO YOU KNODO YOU KNOWWWWW Algorithm is used to calculate the time & space, a program takes for its execution and storage respectively (i.e. running time).

(3)

To assign the values to the variables A & B using an algorithm in English Programming style just write the following lines:

set A <- {Enter first input} or set A := {Enter first input} set B <- {Enter second input} or set B := {Enter second input} 3.3.

3.3. 3.3. 3.3.

3.3.1111... Char1 CharCharCharCharactacterisactactacteriseriseriseristics of Algorithmstics of Algorithmstics of Algorithmstics of Algorithmstics of Algorithms

1. Input : Zero or more values externally supplied to Algorithm. 2. Output : Zero or more values produced by Algorithm.

3. Definiteness : Each instruction must be clear and unambiguous, i.e. having one and only one meaning.

4. Finiteness : For all cases, algorithm must terminate after finite number of steps or it should be complete.

5. Effectiveness : Every instruction must be efficient and also feasible as far as execution is concerned (in terms of space and time).

3.3.2. 3.3.2. 3.3.2. 3.3.2.

3.3.2. FFFFFororororor mat of an Algorithmmat of an Algorithmmat of an Algorithmmat of an Algorithmmat of an Algorithm

FORMA FORMAFORMA FORMA

FORMAT OF ALT OF ALT OF ALT OF ALT OF ALGORITHMGORITHMGORITHMGORITHMGORITHM

Algorithm-name (input, output) Input: Small description of the input Output: Small description of the output 1.

2. Algorithm-body which contains finite number of steps and . every step is properly defined and algorithm should be complete. .

n.

SAMPLE AL SAMPLE ALSAMPLE AL SAMPLE AL

SAMPLE ALGORITHMGORITHMGORITHMGORITHMGORITHM

Sum (A,B, Out) A: first input B: second input

Out: Sum of A + B (output)

1. Get the two inputs from the user 2. Assign the inputs to A & B

3. Set out : = A + B or Set out <- A + B 4. Exit

In the above Sample Algorithm Sum is the name of the algorithm with two inputs namely A & B and one output out. The above algorithm just gets the two inputs from the user and assigned the inputs to the two inputs A & B and stores the result in the output out.

3.3.3. 3.3.3. 3.3.3. 3.3.3.

3.3.3. An ExAn ExAn ExAn ExAn Ex amamamamamplepleplepleple

(4)

+0)26-4

!

AL ALAL AL

ALGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUGORITHM IN ENGLISH LANGUAGORITHM IN ENGLISH LANGUAAAGE SAGE STGE SGE SGE STTTT YLE FYLE FOR THE ABYLE FYLE FYLE FOR THE ABOR THE ABOR THE AB OOR THE ABOOVE PROOVE PRVE PRVE PRVE PROBLEMOBLEMOBLEMOBLEMOBLEM Print (A)

A: A is a variable used for checking purpose that weather the value exceeds 10 or not 1. set A equal to 1

2. Repeat steps 3 & 4 while (A < 11) 3. Print the value of A

4. Increment the value of A by 1 5. Exit

AL ALAL AL

ALGORITHM IN ENGLISH PRGORITHM IN ENGLISH PRGORITHM IN ENGLISH PRGORITHM IN ENGLISH PROGRAMMING SGORITHM IN ENGLISH PROGRAMMING SOGRAMMING SOGRAMMING SOGRAMMING S TTTTT YLE FYLE FYLE FOR THE ABYLE FYLE FOR THE ABOR THE ABOR THE ABOR THE AB OOOVE PROOVE PRVE PRVE PRVE PROBLEMOBLEMOBLEMOBLEMOBLEM

1. Set A ←←←←← 1

2. Do (step 3 & 4) while (A < 11) 3. Print A 4. A ←←←←← A + 1 5. Exit IMPLEMENT IMPLEMENTIMPLEMENT IMPLEMENT

IMPLEMENTAAAAATION OR C PRTION OR C PRTION OR C PRTION OR C PRTION OR C PROGRAM FOGRAM FOGRAM FOGRAM FOGRAM FOR THE ABOR THE ABOOR THE ABOR THE ABOR THE ABOOOVE PROVE PRVE PRVE PRVE PROBLEMOBLEMOBLEMOBLEMOBLEM

# include <stdio.h> main () { int A; A = 1; while (A < 11) { printf (“%d”,A); A ++; } } 3.3.4. 3.3.4. 3.3.4. 3.3.4.

3.3.4. Algorithm AnalyAlgorithm AnalyAlgorithm AnalyAlgorithm AnalyAlgorithm Analy sississississis

An algorithm is analyze in terms of their efficiency i.e. how much computer memory space and execution time an algorithm uses, to store and to execute, in terms of complexity.

IMPORTANT NOTES

Complexity is defined as the total space and time required to store and to execute an algorithm or problem.

The complexity comprises of two type’s i.e. 1. Space Complexity

(5)

Space Com Space Com Space Com Space Com

Space Com plepleplepleplexitxitxitxitxit yyyyy

IMPORTANT NOTES

Space complexity of an algorithm is the total space used or required to store an algorithm or program in memory.

Space complexity comprises of two types :

(a) Space for Fixed variables : The space allocated to the variables, which is fixed at compile time called static memory allocation.

(b) Space for vary variables : The space allocated to the variables, which is not fixed instead it is of variable length depend on the size of the value stored in it & which is allocated at run time called dynamic memory allocation.

T T T T

T ime Comime Comime Com pleime Comime Compleplexitpleplexitxitxitxit yyyyy

IMPORTANT NOTES

Time Complexity of an algorithm is total time required to execute an algorithm.

Time complexity comprises of two types :

(a) Compile time : The total time required to check our program in terms of two types of errors namely syntax i.e. physical error & semantic i.e. logical errors.

(b) Run time : The total time required to execute a program.

3.3.5. 3.3.5. 3.3.5. 3.3.5.

3.3.5. TTTTTechniqechniqechniques used techniqechniques used tues used tues used tues used to Design an Algorithmo Design an Algorithmo Design an Algorithmo Design an Algorithmo Design an Algorithm

1 1 1 1

1... RRRRR ecurecurecur sivecurecursivsivsivsive Algorithme Algorithme Algorithme Algorithme Algorithm

Recursive technique is used if the problem is solved by calling the same problem multiple times as shown below :

A (I)

(1) set I = I + 1

(2) if I > 10, exit; Call itself i.e. recursion

(3) else Print “I”;

(4) Go to A (I);

2. 2. 2. 2.

2. Divide and ConqDivide and ConqDivide and ConqDivide and ConqDivide and Conq uerueruerueruer

Divide and Conquer technique is the most important among all. We have three steps involved in it viz.

(i) Divide a given problem into the various sub-problems

(ii) Perform the above step recursively until the problem is solved.

(iii) Then combine all the sub-problems at last level of tree to get the result. 3.

3. 3. 3.

3. ItItItItIterererererativative Meativativative Mee Mee Mee Methodthodthodthodthod

Iterative technique is used to solve a problem using expansion i.e. expand the given Problem until it is not actually solved or we can say if there is any loop in the algorithm called Iterative algorithm.

(6)

+0)26-4 ! 4. 4. 4. 4.

4. Dynamic PrDynamic PrDynamic PrDynamic PrDynamic Progrogrogrogrogr ammingammingammingammingamming

The Algorithm designed using Dynamic Programming approach uses or remembers older results and attempt to use these previous results to speed up the process of finding new results.

5. 5. 5. 5.

5. GrGrGrGrGreedy Algorithmseedy Algorithmseedy Algorithmseedy Algorithmseedy Algorithms

The Algorithm designed using Greedy approach attempts not only to find the solution, but also to find the optimal solution for any given problem.

6. 6. 6. 6.

6. BrBrBrBrBr u tu tu tu tu te Fe Fore Fe Fe Forororor ce Algorithmce Algorithmce Algorithmce Algorithmce Algorithm

The Brute Force approach starts at some random point and iterates through every possibility until it finds a solution.

7 7 7 7

7... BrBrBrBrBranch and Boundanch and Boundanch and Boundanch and Boundanch and Bound

The Algorithm designed using Branch & Bound approach forms a tree like structure of sub-problems to the primary problem, following each branch of the tree until it is either solved or lumped in with another branch.

8. 8. 8. 8.

8. Backtracking AlgorithmBacktracking AlgorithmBacktracking AlgorithmBacktracking AlgorithmBacktracking Algorithm

Backtracking Algorithm test for a solution, if the solution is found the problem given is solved, if not it recurs again and tests again, continuously until a solution is found.

3.3.6. 3.3.6. 3.3.6. 3.3.6.

3.3.6. Some ExSome ExSome ExSome ExSome Ex amamamamamples tples tples to Wples tples to Wo Wo Wo Writritritrite Algorithmsrite Algorithmse Algorithmse Algorithmse Algorithms

Example 1. Write an algorithm to find whether a ∆∆∆∆∆ is right angled or not ?

Triangle (A, B, C)

A: first side of the triangle B: second side of the triangle C: third side of the triangle 1. Set A ←←←←← {Enter first side} 2. Set B ←←←←← {Enter second side} 3. Set C ←←←←← {Enter third side} 4. If A = B2+C2 5. Go to (11) 6. If B = A2+C2 7. Go to (11) 8. If C = A2+B2 9. Go to (11)

10. Print “not forms a right angled triangle” & Exit 11. Print “forms a right angled triangle” & Exit

Example 2. Write an algorithm to check if a given no. is even or odd ?

Evenodd (A)

(7)

1. Set A <- {Enter a number} 2. if ( A % 2 = 0) then

Print “A is Even number” & Exit. 3. Print “ A is Odd number” & Exit.

Example 3. Write an algorithm to find the smallest of 3 numbers?

Smallest (A,B,C) A: first number B: second number C: third number

1. Set A ←←←←← {Enter first number} 2. Set B ←←←←← {Enter second number} 3. Set C ←←←←← {Enter third number} 4. If (A < B & A < C) then

5. Print “A is smallest” & Exit. 6. If (B < C & B < A) then

7. Print “B is smallest” & Exit. 8. If (C < A & C < B) then

9. Print “C is smallest” & Exit.

Example 4. Write an algorithm to swap two numbers using third variable ?

Swap (A,B)

A: first number B: second number

1. Set A ←←←←← {Enter first number} 2. Set B ←←←←← {Enter second number} 3. Set C ←←←←← A

6. Set A ←←←←← B 7. Set B ←←←←← C 8. Exit.

Example 5. Write an algorithm to swap two numbers without using third variable?

Swap (A,B)

A: first number B: second number

(8)

+0)26-4

!

1. Set A ←←←←← {Enter first number} 2. Set B ←←←←← {Enter second number} 3. Set A ←←←←← A + B 6. Set B ←←←←← A - B 7. Set A ←←←←← A - B 8. Exit.

3.4.

3.4.

3.4.

3.4.

3.4. FL

FL

FLO

FL

FL

O

O

O W CHAR

O

W CHAR

W CHAR

W CHAR

W CHAR T

T

T

T

T

Flow chart is the pictorial representation of the Algorithm.

IMPORTANT NOTES

This is a modeling tool to describe an algorithm pictorially or graphically, which is easy to understand.

3.4. 3.4. 3.4. 3.4.

3.4.1111... Adv1 AdvAdvAdvAdvantantantages of Floantantages of Floages of Floages of Floages of Flow Charw Charw Charw Charw Char tststststs

n Being graphical in nature, they are easier to understand.

n It can be reviewed & corrected easily, if found faulty. n They provide effective algorithm documentation. n Promotes understanding of a process.

n Identifies problem areas and opportunities for process improvement. n Provides a way of training employees.

n Depicts customer-supplier relationships.

3.4.2. 3.4.2. 3.4.2. 3.4.2.

3.4.2. Symbols Used in FloSymbols Used in FloSymbols Used in FloSymbols Used in FloSymbols Used in Flow Charw Charw Charw Charw Char ttttt

Symbols used Name Used in flow charts

OVAL Used for start and stop

PARALLELOGRAM Used for input and output.

RECTANGLE Used for processing

Diamond Box Used for decision

LINE Used for showing flow of control

CONNECTOR Used to join two different pages DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNOWWWWW Flow-Char t is used to generate the sequence or flow of events in which problem is solved and represent the flow of events graphically.

(9)

3.4.3. 3.4.3. 3.4.3. 3.4.3.

3.4.3. ExExExExExamamamamamples of Floples of Flow Charples of Floples of Floples of Flow Charw Charw Charw Char tststststs

Example 1. Draw a flow chart to ADD two numbers. Solution.

S TAR T

Input Tw o Num bers A AND B

C: = A + B

PRIN T C

STOP Fig. 3.1.

Example 2. Draw the flow chart to find whether a ∆∆∆∆∆ is right angled or not? Solution. S TA R T

If A= B2+C2

Print "fo rm s a rig ht an g led tria ng le"

N O If B= A2+C2 If C= A2+B2 N O N O S T O P Y E S Y E S Y E S Fig. 3.2.

(10)

+0)26-4

!

Example 3. Draw the flow chart to Find smallest number of 3 numbers. Solution. STA R T IN P U T 3 n u m be r a, b , c If a > b If b > c Prin t c is s m allest Prin t b is sm allest ST OP If a > c p rin t a is sm alle st Yes N o Yes N o Yes N o Fig. 3.3.

Example 4. Draw the flow chart to find average of 3 numbers ?

Solution. STA RT INP U T a, b, c AVE R AGE = (a + b + c)/3 PRIN T AV ERA G E STOP Fig. 3.4.

(11)

Example 5. S TA R T S U M = 0 N = 0 N = N + 1 S U M = S U M + N Is N = 5 0 ? Yes P R IN T S U M E N D Fig. 3.4.

Example 6. So ftw are D evelop m ent

Start D es ig n C oding Testing E n d D es ig n E rror? Yes Yes N o N o E rrors? Fig. 3.5. Example 7. Sta rt E n d In pu t N M = 1 F = 1 O utpu t F D o es M = N ? F = F *M M = M + 1 N o F = 1 *2*3 ... *N Yes Fig. 3.6.

(12)

+0)26-4 !

3.5.

3.5.

3.5.

3.5.

3.5. DA

DA

DAT

DA

DA

T

T

TA FL

T

A FL

A FLO

A FL

A FL

O

O

O

OW DIA

W DIA

W DIA

W DIA

W DIAGRAM (DFD)

GRAM (DFD)

GRAM (DFD)

GRAM (DFD)

GRAM (DFD)

IMPORTANT NOTES

It is modeling tool that allow us to make system as a network of functional processes, connected one another by “Pipelines” & “Holding Tanks” of data.

Synon Synon Synon Synon

Synon ymymymymyms fs fs fs fs for DFDsor DFDsor DFDsor DFDsor DFDs 1. Bubble Chart 2. Process Model 3. Bubble Diagram 4. Work Flow Diagram 5. Function Model

It is one of the most commonly used system modeling tool for operational system in which the functions of the system are of permanent importance & more complex than the data that system manipulates.

It is first used is software engineering.

3.5. 3.5. 3.5. 3.5.

3.5.111... S11 SSSS ttttteps in Dateps in Dateps in Data Floeps in Dateps in Data Floa Floa Floa Flow Analyw Analyw Analyw Analysisw Analysissississis

n Study operations & ongoing process.

n Identify how data is processed in handling transactions. n Identify the boundary of the underlying system.

n Identify external entities. n Identify processes.

n Identify data stores.

Identify data flow among processes, data store & external entities.

3.5.2. 3.5.2. 3.5.2. 3.5.2.

3.5.2. DatDatDatData FloData Floa Flow Diagra Floa Flow Diagrw Diagrw Diagrw Diagramsamsamsamsams

Data flow diagrams can be used to provide a clear representation of any business function. The technique starts with an overall picture of the business and continues by analyzing each of the functional areas of interest. This analysis can be carried out to precisely the level of detail required. The technique exploits a method called top-down expansion to conduct the analysis in a targeted way.

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagr am Nam Noam Nam Nam Nooo ttttt ationso ationsationsationsations

There are only five symbols that are used in the drawing of business process diagrams (data flow diagrams). These are now explained, together with the rules that apply to them. DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNOWWWWW Data Flow Diagram is used to check the flow of data i.e. how data is stored in database or how data is retrieved from the database or how it is updated.

(13)

C u sto m er A ccou nt in fo rm ation C as h A ccou nt in fo rm ation D 2 A cc ou n t D etails En quiries D eposits and W ithdraw als 2 C o u n ter Fig. 3.7.

This diagram represents a banking process, which maintains customer accounts. In this example, customers can withdraw or deposit cash, request information about their account or update their account details. The five different symbols used in this example represent the full set of symbols required to draw any business process diagram.

Ext Ext Ext Ext

Extererererer nal Entitnal Entitnal Entitnal Entitnal Entit yyyyy

An external entity is a source or destination of a data flow which is outside the area of study. Only those entities which originate or receive data are represented on a business process diagram. The symbol used is an oval containing a meaningful and unique identifier.

Pr Pr Pr Pr Processocessocessocessocess

A process shows a transformation or manipulation of data flows within the system. The symbol used is a rectangular box which contains 3 descriptive elements :

Firstly an identification number appears in the upper left hand corner. This is allocated arbitrarily at the top level and serves as a unique reference.

Secondly, a location appears to the right of the identifier and

describes where in the system the process takes place. This may, for example, be a department or a piece of hardware. Finally, a descriptive title is placed in the centre of the box. This should be a simple imperative sentence with a specific verb, for example ‘maintain customer records’ or ‘find driver’.

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flowwwww

A data flow shows the flow of information from its source to its destination. A data flow is represented by a line, with arrowheads showing the direction of flow. Information always flows to or from a process and may be written, verbal or electronic. Each data flow may be referenced by the processes or data stores at its head and tail, or by a description of its contents.

Dat Dat Dat Dat

Dat a Sa Sa Sa Sa S tttttororororeoreeee

A data store is a holding place for information within the system:

It is represented by an open ended narrow rectangle.

Data stores may be long-term files such as sales ledgers, or may be short-term accumulations: for example batches of documents that are waiting to be processed. Each data store should be given a reference followed by an arbitrary number.

C u sto m er

En quiries D epos its and W ithdraw als 2 C ounte r

A ccou nt in fo rm ation

(14)

+0)26-4 ! R R R R

R esouresouresouresouresour ce Floce Floce Floce Floce Flowwwww

A resource flow shows the flow of any physical material from its source to its destination. For this reason they are sometimes referred to as physical flows.

The physical material in question should be given a meaningful name. Resource flows are usually restricted to early, high-level diagrams and are used when a description of the physical flow of materials is considered to be important to help the analysis.

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flow Diagrw Diagrw Diagr am–Rw Diagrw Diagram–Ram–Ram–Ram–Relationship Gridelationship Gridelationship Gridelationship Gridelationship Grid

External Entity

Process

D ata Store

External Entity Process D ata Store

Fig. 3.8.

There are rules governing various aspects of the diagram components and how they can relate to one another.

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flowwwww sssss

For data flows the rules are as follows :

Data flows and resource flows are allowed between external entities and processes. Data flows are also allowed between different external entities. However, data flows and resource flows are not allowed between external entities and data stores.

Pr Pr Pr Pr

Processesocessesocessesocessesocesses

For processes the data flow rules are as follows:

Data flows and resource flows are allowed between processes and external entities and between processes and data stores. They are also allowed between different processes. In other words processes can communicate with all other areas of the business process diagram. Dat Dat Dat Dat Dat a Sa Sa Sa Sa S ttttt ororororor eseseseses

For data stores the data flow rules are as follows:

Data flows and resource flows are allowed between data stores and processes. However, these flows are not allowed between data stores and external entities or between one data store and another. In practice this means that data stores cannot initiate a communication of information, they require a process to do this.

(15)

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram – Contam – Contam – Contam – Conteam – Conte xt Diaeeext Diaxt Diaxt Diaxt Diag rg rg rg ramg ramamamam

B oo k Su pplier B oo k D etails B oo k O rder B orro w er B oo k R eturn R equest Availability and A dvice 0 C ontext Library R eservatio n En quiry B orro w er N um ber Fig. 3.9.

The context diagram represents the entire system under investigation. This diagram should be drawn first, and used to clarify and agree the scope of the investigation.

The components of a context diagram are clearly shown on this screen. The system under investigation is represented as a single process, connected to external entities by data flows and resource flows.

The context diagram clearly shows the interfaces between the system under investigation and the external entities with which it communicates. Therefore, whilst it is often conceptually trivial, a context diagram serves to focus attention on the system boundary and can help in clarifying the precise scope of the analysis.

The context diagram shown on this screen represents a book lending library. The library receives details of books, and orders books from one or more book suppliers.

Books may be reserved and borrowed by members of the public, who are required to give a borrower number. The library will notify borrowers when a reserved book becomes available or when a borrowed book becomes overdue.

In addition to supplying books, a book supplier will furnish details of specific books in response to library enquiries.

Note, that communications involving external entities are only included where they involve the ‘system’ process. Whilst a book supplier would communicate with various agencies, for example, publishers and other suppliers - these data flow are remote from the ‘system’ process and so this is not included on the context diagram.

Guidelines t Guidelines t Guidelines t Guidelines t

Guidelines to Dro Dro Dro Drao Draaaa w Contw Contw Contew Contw Conteeee xt Diagrxt Diagrxt Diagrxt Diagrxt Diagramamamamam

Firstly, draw and name a single process box that represents the entire system.

Next, identify and add the external entities that communicate directly with the process box. Do this by considering origin and destination of the resource flows and data flows.

(16)

+0)26-4

!

In drawing the context diagram you should only be concerned with the most important information flows. These will be concerned with issues such as: how orders are received and checked, with providing good customer service and with the paying of invoices. Remember that no business process diagram is the definitive solution - there is no absolute right or wrong.

Le Le Le Le

Levvvvel 1 Diagrvel 1 Diagrel 1 Diagrel 1 Diagrel 1 Diagramamamamam

External Entity External Entity Process Process Process D ata Store D ata Store D ata Store Fig. 3.10.

The level 1 diagram shows the main functional areas of the system under investigation. As with the context diagram, any system under investigation should be represented by only one level 1 diagram.

There is no formula that can be applied in deciding what is, and what is not, a level 1 process. Level 1 processes should describe only the main functional areas of the system, and you should avoid the temptation of including lower level processes on this diagram. As a general rule no business process diagram should contain more than 12 process boxes.

The level 1 diagram is surrounded by the outline of a process box that represents the boundaries of the system. Because the level 1 diagram depicts the whole of the system under investigation, it can be difficult to know where to start.

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagram—Tam—Top-Doam—Tam—Tam—Top-Doop-Doop-Doop-Down Expansionwn Expansionwn Expansionwn Expansionwn Expansion

The section explains the process of top down expansion, or leveling. Furthermore, it illustrates that whilst there can only be one context and one level 1 diagram for a given system, these normally give rise to numerous lower level diagrams.

Each process within a given business process diagram may be the subject of further analysis. This involves identifying the lower level processes that together constitute the process as it was originally identified. This procedure is known as top-down expansion or leveling.

As a business process diagram is decomposed, each process box becomes a boundary for the next, lower level, diagram.

In order to illustrate the process of top-down expansion, consider the three processes shown within this business process diagram. No detail is shown, only the outline of the process boxes, which have been identified during the drawing of a level 1 diagram.

(17)

Level X

Level X+1

Fig. 3.11.

Any area of a level 1 diagram is likely to require further analysis, as the level 1 diagram itself only provides a functional overview of the business system.

Therefore, below the level 1 diagram there will be a series of lower level diagrams. These are referred to as level 2, level 3, etcetera. In practice, level 2 is usually sufficient and it is unusual to carry out an analysis beyond level 3.

In this example the process numbered 3, at level 1, will be investigated further thereby giving rise to a level 2 diagram.

In the level 2 diagram four processes of interest have been identified and the numbering of these processes must reflect the parent process. Therefore the level 2 processes are numbered 3.1, 3.2, 3.3 and 3.4

Suppose that of these four level 2 processes, one was of sufficient interest and complexity to justify further analysis. This process, let’s say 3.3, could then be further analyzed resulting in a corresponding level 3 diagram. Once again the numbering of these processes must reflect the parent process. Therefore these three level 3 processes are numbered 3.3.1, 3.3.2 and 3.3.3.

Dat Dat Dat Dat

Dat a Floa Floa Floa Floa Flow Diagrw Diagrw Diagrw Diagrw Diagr am—Nam—N umbering Ram—Nam—Nam—Numbering Rumbering Rumbering Rumbering Ruleuleuleuleule

The process boxes on the level 1 diagram should be numbered arbitrarily, so that no priority is implied. Even where data from one process flows directly into another process, this does not necessarily mean that the first one has to finish before the second one can begin.

Therefore the processes on a level 1 diagram could be re-numbered without affecting the meaning of the diagram. This is true within any business process diagram - as these diagrams do not imply time, sequence or repetition.

However, as the analysis continues beyond level 1 it is important that a strict numbering convention is followed. The processes on level 2 diagrams must indicate their parent process within the level 1 diagram. This convention should continue through level 3 diagrams, and beyond, should that level of analysis ever be required.

(18)

+0)26-4 ! 3 Process 3.2 Process 3.3 Process 3.1 Process 3.3.4 Process 3.3.1 Process 3.3.3 Process 3.3.2 Process Fig. 3.12.

The diagram on this screen clearly illustrates how processes on lower level diagrams identify their ancestral path.

3.5.3. 3.5.3. 3.5.3. 3.5.3.

3.5.3. AdvAdvAdvAdvAdvantantantantages of DFDantages of DFDages of DFDages of DFDages of DFD

n Easily understood by users & business persons n Identify design errors early in the development

n It helps analysts to understand the under lying business processors

3.5.4. 3.5.4. 3.5.4. 3.5.4.

3.5.4. DeDeDeDeDevvvvveloping a DFDeloping a DFDeloping a DFDeloping a DFDeloping a DFD

T T T T

Top-Doop-Doop-Doop-Do wn Approp-Down Apprwn Apprwn Apprwn Approachoachoachoachoach

1. The system designer makes “a context level DFD”, which shows the “interaction” (data flows) between “the system” (represented by one process) and “the system environment” (represented by terminators).

2. The system is “decomposed in lower level DFD (Zero)” into a set of “processes, data stores, and the data flows between these processes and data stores”.

3. Each process is then decomposed into an “even lower level diagram containing its subprocesses”.

4. This approach “then continues on the subsequent subprocesses”, until a necessary and sufficient level of detail is reached which is called the primitive process (aka chewable in one bite).

3.5.5. 3.5.5. 3.5.5. 3.5.5.

3.5.5. DFD LeDFD LeDFD LeDFD LeDFD Le vvvvvelselselselsels

Cont Cont Cont Cont

Conteeeee xt Lext Lext Lext Le vxt Levvvv elelelelel

This level shows the overall context of the system and it’s operating environment and shows the whole system as just one process. It does not usually show data stores, unless

(19)

they are “owned” by external systems, e.g. are accessed by but not maintained by this system, however, these are often shown as external entities.

Le Le Le Le Le vvvvv el 0el 0el 0el 0el 0

This level shows all processes at the first level of numbering, data stores, external entities and the data flows between them. The purpose of this level is to show the major high level processes of the system and their interrelation. A process model will have one, and only one, level 0 diagram. A level 0 diagram must be balanced with it’s parent context level diagram, i.e. there must be the same external entities and the same data flows, these can be broken down to more detail in the level 0, e.g. the “1enquiry” data flow could be spilt into “enquiry request” and “enquiry results” and still be valid.

3.5.6. 3.5.6. 3.5.6. 3.5.6.

3.5.6. ExExExExEx amamamamample of DFDple of DFDple of DFDple of DFDple of DFD

1 1 1 1

1... AutAutAutAutAutomatomatomatomated Couromated Coured Coured Coured Cour se Rse Rse Rse Rse Regisegisegisegisegis trtrtrtrtr ationationationationation

E X T E R N A L E N TIT Y A P P L IC AT IO N A C C E P T/D E C L IN E E N R O L LM E N T C H E C K A P P L IC A N T Q U A L IFIC AT IO N 2 C H E C K C O U R S E AVA IL A B IL IT Y 1 E N Q U IR Y C O U R S E S A P P L IC AT IO N S R E P LY R E P LY E N Q U IR Y Fig. 3.13.

The DFD is based on automatic course registration shown in Fig. 3.13 and it checks automatically weather the course for which applicant is applied is available, as shown above as (1), by checking the database where all the records are stored and if it is available then it again checks weather the applicant fulfill the requirement qualification, as shown above as (2), and if it fulfills then the application is accepted otherwise rejected.

2. 2. 2. 2.

2. Online OrOnline OrOnline OrOnline OrOnline Order Syder Syder Syder Syder Sy sssss tttttememememem

The DFD is based on online order system shown in Fig. 3.14 and it processes the customer order that he had made online, shown as (1) in the above figure. Entry is done in database D1. It also verify that the payment is approved or not by user’s credit card or it’s rejected

(20)

+0)26-4

!

in (2) i.e. cyber check. If the payment is approved then it made an entry in inventory Database D2 after adding shipping charges and confirms the order & tells the customer the delivery date of the product with product type & total amount.

C U S TO M E R 3 S H IP P IN G S H IP O R D E R 2 C Y B E R C H E C K V E R IF Y C R E D IT C A R D 1 E -C O M M E R C E P R O C E S S O R D E R A C K N O W L E D G E M E N T O R D E R C O N F IR M AT IO N A N D D E LIV E RY D AT E C R E D IT C A R D C O M PA N Y D 2 IN V E N TO R Y C U S TO M E R D ATA B A S E D 1 C R E D IT C A R D N U M B E R A N D O T H E R A M O U N T A P P R O VA L O R R E JE C TIO N O R D E R IN FO R M AT IO N P R O D U C T T Y P E A N D A M O U N T C U S TO M E R A N D O R D E R IN F O R M AT IO N Fig. 3.14. 3. Ex 3. Ex 3. Ex 3. Ex 3. Ex amamamampleampleplepleple

A p plie s to U n ive rs ity A p pro va l R e g is tra tio n Stu d e n t In fo rm a tio n A c c e p ta n c e L e tte r D e n ia l L etter P ro g re ss R e p o rt A p plica tio n

Stu d e n t In form a tio n Stu d e n t

Stu d e n t D a ta b a se

(21)

4. A Le 4. A Le 4. A Le 4. A Le

4. A Le vvvvv el Datel Datel Datel Dat a Floel Data Floa Floa Floa Flow Diagrw Diagrw Diagram fw Diagrw Diagram fam fam fam for the Same Syor the Same Sysor the Same Syor the Same Syor the Same Syssss tttttememememem

C u stom er C u stom er C u stom er E n qu iry P ro cess E n qu iry 1 P ro cess E n qu iry 2 C us tom ers Store D 2 Item Store D 2 Item In fo rm a tion

Item d eta ils/ a va ilab ility C u stom er D e ta ils O rd er Store D 3 O rd er O rd er D etails Item s Inv oice Fig. 3.16.

3.6.

3.6.

3.6.

3.6.

3.6. TEXT EDIT

TEXT EDIT

TEXT EDIT

TEXT EDITOR

TEXT EDIT

OR

OR

OR

OR

IMPORTANT NOTES

Text editor is a program that enables you to create and edit text files.

There are many different types of editors, but they all fall into two general categories: 1

1 1 1

1... Line EditLine EditLine EditLine EditLine Editororororor sssss

A primitive form of editor that requires you to specify a specific line of text before you can make changes to it.

2. 2. 2. 2.

2. ScrScrScrScreen-OrientScreen-Orienteen-Orienteen-Oriented Editeen-Oriented Editored Edited Edited Editorororor sssss

It is also called as full-screen editors, these editors enable you to modify any text that appears on the display screen by moving the cursor to the desired location.

3.6. 3.6. 3.6. 3.6.

3.6.11111... TTTTTypes of Types of Types of Types of Types of Tee xt Editeeext Editxt Editxt Editxt Editorororororsssss

(1) (1) (1) (1)

(1) NNNNN oooo ttttt epad++ (used only in Wo epad++ (used only in Wepad++ (used only in Wepad++ (used only in Wepad++ (used only in Windoindoindoindoindoww s operwwws opers opers opers operating syating sy sating syating syating syssss tttttem)em)em)em)em)

Notepad++ is the text editor which is used in many Windows Operating System and which is able to provide better features compared to Notepad. It handles most of the advanced features, like syntax highlighting, code folding, and macros.

(22)

+0)26-4

!

The Screen shot of Notepad++ is shown below

Fig. 3.17.

(2) (2) (2) (2)

(2) Emacs (used in all platfEmacs (used in all platfEmacs (used in all platfEmacs (used in all platfEmacs (used in all platfororororor ms i.e. use anms i.e. use an y operms i.e. use anms i.e. use anms i.e. use any opery opery opery operatingatingatingatingating s y

s ys y s ys y sssss ttttt em)em)em)em)em)

Emacs (Editor MACroS) is popular as it has built-in macros and powerful keyboard commands. The Emacs is virtually for every platform.

The Screen shot of Emacs is shown below

Fig. 3.18.

DO YOU KNO DO YOU KNODO YOU KNO DO YOU KNODO YOU KNOWWWWW Platform independent means that the editor is independent on the operating system that the system uses i.e. the editor can be run either on windows or Mac OS or Unix or Linux.

(23)

(3) (3) (3) (3)

(3) UltrUltrUltrUltrUltr aEdit (used only in WaEdit (used only in WaEdit (used only in WaEdit (used only in WaEdit (used only in Windoindoindoindoindowww s operwws opers opers oper ating sys operating sysating syating syating syssss tttttem)em)em)em)em)

UltraEdit is a user-friendly programming text editor which have the features including, syntax highlighting, code folding, macros, and tons of similar features available. UltraEdit focuses mainly on web development, with in-build advanced features like HTML, PHP, JavaScript, and much more.

The Screen shot of UltraEdit is shown below

Fig. 3.19.

(4) (4) (4) (4)

(4) TTTTTeeeee xtMatxtMatxtMatxtMatxtMate (used only in Mac OSX opere (used only in Mac OSX operating sye (used only in Mac OSX opere (used only in Mac OSX opere (used only in Mac OSX operating syating syating syating sysssss ttttt em)em)em)em)em)

TextMate is a powerful and attractive text editor launched just a few years back and quickly gained a rapid popularity with it’s attractive interface, powerful macros, and downloadable.

The Screen shot of TextMate is shown below :

(24)

+0)26-4 ! (5) (5) (5) (5)

(5) Vim (used in all platfVim (used in all platfVim (used in all platfVim (used in all platfVim (used in all platfororororor ms)ms)ms)ms)ms)

Vim is very similar to Emacs, earlier version of the Vi text editor. Like Emacs, Vim is available in several forms. Apart from the original version, there are gVim or gVim Portable for Windows and MacVim for the Mac.

The Screen shot of Vim is shown below

Fig. 3.21.

(6) (6) (6) (6)

(6) TTTTTeeeee xtPxtPad (used only in windoxtPxtPxtPad (used only in windoad (used only in windoad (used only in windoad (used only in windoww s operwwws opers opers operating sys operating sysating syating syating syssss ttttt em)em)em)em)em)

Like all above text editors, TextPad is also having advanced features for programmers like syntax highlighting, code blocking, and macros, along with a clip library feature.

The Screen shot of TextPad is shown below

(25)

3.7

3.7

3.7

3.7

3.7...

VI EDIT

VI EDIT

VI EDITOR

VI EDIT

VI EDIT

OR

OR

OR

OR

VI is another text editor, which is used to create & edit text files & Pronounced as “Vee eye editor” and which is available on all UNIX system.

The VI editor has the powerful features to aid programmers.

3.7 3.7 3.7 3.7

3.7...111... Vi T11 Vi TVi TVi TVi Teee xt Editeext Editxt Editxt Editxt Editor Operor Operor Operor Operor Operating Modesating Modesating Modesating Modesating Modes

VI text editor is generally operates in either insert mode or command mode.

IMPORTANT NOTES

When the editor is in insert mode then whatever typed becomes the part of the document and put these typed keystrokes into the current file.

IMPORTANT NOTES

When the editor is in command mode then the keystrokes entered by keyboard are interpreted as commands that control the edit session.

Typing ‘i’ while in command mode switches the editor into insert mode. Typing ‘i’ again at this point places an ‘i’ character in the document.

3.7 3.7 3.7 3.7

3.7.2..2..2..2. Ho.2. HoHoHoHow tw to Sw tw tw to So So Stttttaro S ar t the VI Tararart the VI Tt the VI Tt the VI Tt the VI Teee xt Editeext Editxt Editxt Editxt Editororororor

The VI editor enables a user to create new files or edit existing files. The command to start the VI editor is vi, followed by the filename. For example to edit a file called temporary, you would type vi temporary. You can start VI without a filename, but when you want to save your work, you will have to tell VI which filename to save it into later.

When you start VI for the first time, you will see a screen filled with tildes (A tilde looks like this: ~) on the left side of the screen as shown below:

~ ~ ~ ~ ~ ~ ~ ~

filename N lines, M characters

Any blank lines beyond the end of the file are shown this way. At the bottom of your screen, the filename should be shown, if you specified an existing file, and the size of the file will be shown as well, like this:

“filename” 21 lines, 385 characters

DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNO DO YOU KNOWWWWW VIM is the earlier version of VI text editor.

(26)

+0)26-4

!

If the file you specified does not exist, then it will tell you that it is a new file, like this:

“newfile” [New file]

If you started VI without a filename, the bottom line of the screen will just be blank.

3.7 3.7 3.7 3.7

3.7.3..3..3..3. Ho.3. HoHoHoHow tw tw tw to Exit frw to Exit fro Exit fro Exit from VI To Exit from VI Tom VI Tom VI Teom VI Teee xt Editext Editxt Editxt Editxt Editororororor

Now that you know how to get into VI, now this session tells you how to exit from the Vi text editor. The VI editor has two modes and in order to get out of VI, you have to be in command mode.

Hit the key labeled “Escape” or “Esc” to get into command mode. If you were already in the command mode when you again hit “Escape” key, don’t worry, it might beep, but you will still be in the command mode.

3.7 3.7 3.7 3.7

3.7.4..4. T.4..4..4. TTTTeeee xt Bufext Bufxt Bufxt Bufxt Buf fffffererererers used in VI Ts used in VI Ts used in VI Ts used in VI Tes used in VI Tee xt Editeext Editxt Editxt Editxt Editororororor

The VI editor has 36 buffers for storing pieces of text, out of which one buffer is a general purpose buffer. Any time a block of text is deleted from the file, it gets placed into the general purpose buffer. The block of text is also stored in another buffer other than general purpose buffer as well, if it is specified by user. The buffer is specified using the “command”. For example, the command: “mdd” uses the buffer m, and the last two characters stand for delete current line.

3.7 3.7 3.7 3.7

3.7.5..5..5..5. Some Sim.5. Some SimSome SimSome SimSome Simple VI Tple VI Tple VI Teple VI Tple VI Teeee xt Editxt Editxt Editxt Editxt Editor Commandsor Commandsor Commandsor Commandsor Commands

Following are some simple set of commands used in VI Text editor.

Command Description

:w filename Writes (saves) the current document. If the optional filename is provided, the text is saved in the specified file.

:q Quits the editor without saving the current file. :vi filename Loads the specified file into the editor.

:n Loads the next file into the editor. Useful when vi was invoked from the command line with multiple file names.

:r filename Reads (inserts) the content of the specified file into the current document. :wq Quits the editor and save the current file.

:a enter insert mode, the characters typed in will be inserted after the current cursor position. If you specify a count, all the text that had been inserted will be repeated that many times.

:h move the cursor to the left one character position.

:i enter insert mode, the characters typed in will be inserted before the current cursor position. If you specify a count, all the text that had been inserted will be repeated that many times.

:j move the cursor down one line. :k move the cursor up one line.

:l move the cursor to the right one character position.

:r replace one character under the cursor. Specify count to replace a number of characters :u undo the last change to the file. Typing u again will re-do the change.

:x delete character under the cursor. Count specifies how many characters to delete. The characters will be deleted after the cursor.

(27)

3.7 3.7 3.7 3.7

3.7.6..6..6..6. Com.6. ComComComCompilation and Rpilation and Running a Vi tpilation and Rpilation and Rpilation and Running a Vi tunning a Vi tunning a Vi teunning a Vi te xt editeeext editxt editxt editor prxt editor pror pror progror progrogrogramogramamamam

To Compile a file with filename filename.c

CC filename.c OR

GCC filename.c

To Run a file with filename filename.c

a.Out OR /a.out

a.out or /a.out will run a file which is currently closed or saved using Vi text editor.

SUMMAR

SUMMAR

SUMMAR

SUMMAR

SUMMARY

Y

Y

Y

Y

1. Problems are obstacles or undesirable situations that prevent us from getting an objective. So there is thirst to solve the problem in order to get objective.

2. An Algorithm is the step-by-step procedure to solve a particular problem in our own Language.

3. Complexity is defined as the total space and time required to store and to execute an algorithm or problem.

4. Space complexity of an algorithm is the total space used or required to store an algorithm or program in memory.

5. Time Complexity of an algorithm is total time required to execute an algorithm. 6. This is a modeling tool to describe out algorithm pictorially or graphically, which is easy

to understand

7. DFD is modeling tool that allow us to make system as a network of functional processes, connected one another by “Pipelines” & “Holding Tanks” of data.

8. Different techniques used to design an algorithms are recursion, divide & conquer, backtracking, branch & bound, iterative, Dynamic programming, greedy approach, brute force method.

9. Various symbol used in the flow chart are oval, rectangle, parallelogram, diamond box, connector, line.

10. The “Process entity” identifies a process taking place, it must have at least one input and output.

11. The “Data Flow entity” identifies the flow of data between processes, data stores & external entities.

12. The “Data Store entity” identifies stores of data, both manual and electronic.

13. The “External Entity” identifies external entities which interacts with the system, usually clients but can be within the same organization.

14. Text editor is a program that enables you to create and edit text files

15. Line editor is A primitive form of editor that requires you to specify a specific line of text before you can make changes to it.

16. Screen-oriented editors are the editors enable you to modify any text that appears on the display screen by moving the cursor to the desired location.

17. VI is another text editor, which is used to create & edit text files & Pronounced as “Vee eye editor” and which is available on all UNIX system.

(28)

+0)26-4

!

18. When the editor is in insert mode then whatever typed becomes the part of the document and put these typed keystrokes into the current file.

19. When the editor is in command mode then the keystrokes entered by keyboard are interpreted as commands that control the edit session.

EXER

EXER

EXER

EXER

EXERCISES

CISES

CISES

CISES

CISES

1. What are the characteristics of an algorithm?

2. Write an algorithm to swap two numbers without using third variable. 3. What is the difference between a flowchart & Data flow Diagram ?

4. Draw a flowchart that reads two numbers ‘x’ & ‘y’ and prints the bigger of them. It gives an appropriate message if both the numbers are same

5. What is Vi editor ?

6. Write an algorithm to generate Fibonacci series and also draw the flowchart. 7. Explain in brief different modes of Vi editor and list the commands ?

8. Why does data flow diagram is required in modeling software system. Give some data flow diagram at different levels for any example software system ?

9. Draw a flowchart to find whether the given number is prime or not. 10. What do you mean by algorithm ? Give an example.

11. What is the difference between a flowchart and data flow diagram ? 12. Draw flowchart for the following :

(i) to sort a list of ‘N’ numbers

(ii) to find the sum of digits of a number. 13. Draw flow chart for the following :

(i) to find the smallest number from a list of ‘N’ numbers (ii) to print the digits of a number in reverse order. 14. Briefly discuss the features of VI editor.

15. Explain DFD with an example.

16. What is the difference between Screen editor and line editor ?

17. Three points are given (x1,y1), (x2,y2) and (x3,y3). Obtain a flowchart to check if they are collinear.

18. Write short note on editing tools ?

References

Related documents

exchanger. The final cooling could be done with water which removes the last hardened flux on the inside and outside around the solder. The minimal compound of silver must be at

Second, we showed that self-reported gluten sensitivity (srGS) individuals more frequently reported symptoms upon consumption of products high in FODMAPs.. Third, quite surprisingly,

Australia, Canada, China, France, Hungary, India, Indonesia, Iran, Israel, Japan, Jordan, Korea, Malaysia, South Africa, Taiwan, Thailand, Turkey, UK, USA.. 

However, previous studies analyzing price asymmetry in Ghanaian maize markets have not focused on testing asymmetric adjustment in the long run relationship between the retail

We organise the paper in the following way. We collect necessary information of the Matrix Algebra in Section 2. The equivalent characterisations of matrix Φ -entropy functionals

In a framework with inelastic labor supply, it is well known that the small surplus calibration of Hagedorn and Manovskii (2008) is able to match the raw volatilities of

In our solution the input data provided to the multi-layer neural network is extracted from the trust-user-item network and consists of the relationships between users and items and

Each variable (total and foster parent social support, global self-worth, perceived social acceptance, perceived scholastic competence, internalizing problems, externalizing