0% found this document useful (0 votes)
15 views

Computer Science 3rd Lect

The document provides an overview of program analysis techniques including flow charts, pseudocode, and programming techniques like structured and modular programming. It also discusses searching techniques like linear/sequential search and binary search. The key points are: 1) Flow charts and pseudocode are program analysis tools used to plan program logic before writing actual code. Pseudocode is easier to write than flow charts and converts more easily to code. 2) Structured programming uses sequence, selection, and repetition structures. Modular programming divides problems into simple modules/subroutines controlled by a main program. 3) Linear/sequential search checks each element sequentially to find a match. Binary search divides the list in half with each comparison to
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Computer Science 3rd Lect

The document provides an overview of program analysis techniques including flow charts, pseudocode, and programming techniques like structured and modular programming. It also discusses searching techniques like linear/sequential search and binary search. The key points are: 1) Flow charts and pseudocode are program analysis tools used to plan program logic before writing actual code. Pseudocode is easier to write than flow charts and converts more easily to code. 2) Structured programming uses sequence, selection, and repetition structures. Modular programming divides problems into simple modules/subroutines controlled by a main program. 3) Linear/sequential search checks each element sequentially to find a match. Binary search divides the list in half with each comparison to
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

2.

PROGRAM ANALYSIS
Example of Flow Chart
Draw a flow chart to find square of number from 1 to 10

A
Start

C=1 C= C+1

S=C * C
NO
Is
C>10
PRINT S

Stop
A
Example of Flow Chart
Find the largest number from given two numbers.
Start

READ
NO A,B

IS No
A>B
?

Yes PRINT B

PRINT A

Stop
C) Pseudocode

 It is a programming analysis tools used for planning program logic.


Pseudo means false and code refers to the instruction written in
programming language. It is an limitation of actual computer
instructions. Pseudo instructions are phases written in ordinary
natural language(e.g. English, French, German)
 Pseudo code is made of following basic logic structures that have
been proved to be sufficient for writing any computer program.

1. Sequence
2. Selection
3. Iteration
Advantages of Pseudocode

 Converting a pseudocode to programming language is much easier as


compared to flow chart.
 It’s easy to write pseudocode as compared to drawing flow chart(flow
charts requires more time and efforts) and actual language program
because pseudocode has few rules to follow .So it will concentrate on
logic of program.

Limitation of Pseudocode
1. Graphic representation of program logic is not available in
Pseudocode.
2. As there are no standard rules for writing Pseudocode, different
programmers may use their own style, which may cause
communication problem.
3.3 Programming Techniques

 Before programming user has to decide the method in which program


is to be developed. There are two basic techniques.

1. Structured Programming
2. Modular Programming
1. Structured Programming

 In this programming method, the program is developed in hierarchy


of modules where modules refers to subprogram in the main program.
It is a top to bottom approach.
 In this technique three basic structure are normally adopted such as
1. A Simple Sequence
2. A Selection by decision
3. A Repetition

S1

S2

S3
2. Modular Programming

 In this programming method a main module is prepared just by


writing instructions of control sub modules are prepared by writing
required program in the main program. Each subprogram may be
called as “Function”. Each function perform a specific routine, which
may be required many times in the main program.
 Modular programming reduces rewriting the subprograms. In “C”
language modular programming is more popular. Modular
programming allows complex problems to be divided into simple
parts. All these parts(Modules) are controlled by a single program.
Each modules may be called as subroutine.
Program

Module 1 Module 2 Module 3 Module 4


2.4 Searching

 Searching is an operation or a technique that helps finds the place of


a given element or value in the list. Any search is said to be
successful or unsuccessful depending upon whether the element that
is being searched is found or not. Some of the standard searching
technique that is being followed in the data structure is listed below:
1. Linear Search or Sequential Search
2. Binary Search
1. Linear Search or Sequential Search
 If ‘N’ items are given and you want to find whether item is present in group
of items or not, then algorithm for that is as follows.
1. Start
2. Read N and item to be found
3. Initialize counter i to 1
4. If B[i]=item then print item found at position i
else increment i
5. If i<N then go to step 4
6. If i>N then display “Item not found”
7. Stop
Here i=counter
item=element name(list name)
B->array name
N-> Number of items in list

You might also like