0% found this document useful (0 votes)
33 views21 pages

PPS UNIT A (B)

Uploaded by

jakharshisant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views21 pages

PPS UNIT A (B)

Uploaded by

jakharshisant
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 21

B.

TECH 1ST YEAR(PPS NOTES)


UNIT A(b)

Concept of Problem solving

A computer is a very powerful and versatile machine capable of performing a


multitude of different tasks, yet it has no intelligence or thinking power. The
intelligence Quotient (I.Q) of a computer is zero. A computer performs many
tasks exactly in the same maneras it is told to do. This places responsibility on the
user to instruct the computer in a correct and precise manner, so that the machine
is able to perform the required job in a proper way. A wrong or ambiguous
instruction may sometimes prove disastrous. In order to instruct a computer
correctly, the user must have clear understanding of the problem to be solved. A
part from this he should be able to develop a method, in the form of series of
sequential steps, to solve it. Once the problem is well- defined and a method of
solving it is developed, then instructing the computer to solve the problem
becomes relatively easier task. Thus, before attempt to write a computer program
to solve a given problem. It is necessary to formulate or define the problem in a
precise manner. Once the problem is defined, the steps required to solve it, must
be stated clearly in the required order.

It is the software developer who has to write down the solution to the problem in
terms of simple operations which the computer can understand and execute. In
order to solve a problem by the computer, one has to pass though certain stages or
steps. They are

1. Understanding the problem

2. Analyzing the problem

3. Developing the solution

4. Coding and implementation.

1.Understanding the problem: Here we try to understand the problem to be


solved in totally. Before with the next stage or step, we should be absolutely sure
about the objectives of the given problem.
2.Analyzing the problem: After understanding thoroughly the problem to be
solved, we look different ways of solving the problem and evaluate each of these
methods. The idea here is to search an appropriate solution to the problem under
consideration. The end result of this stage is a broad overview of the sequence of
operations that are to be carries out to solve the given problem.
3.Developing the solution: Here the overview of the sequence of operations that
was the result of analysis stage is expanded to form a detailed step by step
solution to the problem under consideration.

4.Coding and implementation: The last stage of the problem solving is the
conversion of the detailed sequence of operations in to a language that the
computer can understand. Here each step is converted to its equivalent
instruction or instructions in the computer language that has been chosenfor the
implantation.

Define the problem


In problem-solving, a problem is defined as a situation or challenge that requires a
solution.
Defining the problem means that you are diagnosing the situation. This helps take the
further steps for solving the problem. This is not just as simple as defining the problem.
Here you take effective measures to keep track of the situation of the problem.

Key Components of a Problem


1. Goal or Objective:
○ The desired outcome or target that one aims to achieve. This could involve
finding a solution, making a decision, or optimizing a process.
2. Obstacles or Challenges:
○ Factors that hinder progress toward the goal. These can include limitations
in resources, time constraints, conflicting requirements, or uncertainties.
3. Complexity:
○ Problems can range from simple to complex. Simple problems may have
straightforward solutions, while complex problems may require detailed
analysis and multiple steps to resolve.
4. Decision-Making:
○ Solving a problem often involves making choices based on available
information, evaluating alternatives, and assessing their implications.
5. Uncertainty:
○ Many problems involve elements of uncertainty or incomplete information,
requiring assumptions or estimates to guide the solution process.

Example

For instance, consider a scenario where a person wants to plan a vacation:

● Goal: Organize a week-long vacation.


● Obstacles: Limited budget, time off work, and conflicting preferences among travel
companions.
● Complexity: Choosing a destination, accommodation, activities, and travel arrangements.
● Decision-Making: Evaluating options based on cost, time, and preferences.
● Uncertainty: Weather conditions, availability of services, and potential travel restrictions
Program Design

Program design refers to the process of planning and structuring a software program to
effectively solve a specific problem. It involves breaking down the problem into
manageable components and creating a detailed blueprint for implementation. This process
is crucial in developing efficient, maintainable, and scalable software.

Key Steps in Program Design

Problem Definition:

Clearly articulate the problem that needs to be solved. Understand the requirements,
constraints, and desired outcomes.

Requirement Analysis:

Gather and analyze the functional and non-functional requirements. This includes
identifying what the program should do (functional) and how well it should perform (non-
functional, such as speed and reliability).

Algorithm Development:

Create algorithms that outline the step-by-step procedures for solving the problem.
Algorithms can be represented using pseudocode, flowcharts, or structured diagrams.

Data Structure Design:

Determine the appropriate data structures needed to store and manipulate data efficiently.
This may include arrays, linked lists, trees, or hash tables.

Modularization:

Break down the program into smaller, manageable modules or functions. Each module
should have a specific responsibility and interface clearly with other modules. This
promotes code reusability and easier maintenance.

Interface Design:

Design the user interface (if applicable), ensuring it is intuitive and meets user needs. This
can include command-line interfaces, graphical user interfaces (GUIs), or APIs.

Documentation:

Create documentation that describes the design decisions, algorithms, data structures, and
how to use the program. This is essential for future maintenance and for other developers
who may work on the project.

Review and Validation:


Review the design for completeness and correctness. Validate the design against the
requirements to ensure it adequately addresses the problem.

Importance of Program Design

● Efficiency: A well-designed program can perform tasks more efficiently, making


optimal use of resources.
● Maintainability: Clear structure and modularization make it easier to update and
fix issues in the code.
● Scalability: A thoughtful design allows for easier expansion and adaptation as
requirements change or grow.
● Reduced Errors: Planning and designing beforehand helps identify potential
issues, reducing bugs and errors in the final implementation.

Program Development LifeCycles

Program development is the process of creating application programs. Program


development life cycle (PDLC) The process containing the five phases of program
development: analyzing, designing, coding, debugging and testing, and implementing and
maintaining application software.

The following are six steps in the Program Development Life Cycle:
1. Problem Definition

2. Problem Analysis

3. Algorithm Development

4. Coding & Documentation

5. Testing & Debugging

6. Maintenanc
1.Problem Definition

Here, we define the problem statement and decide the boundaries of the problem.

In this phase, we need to understand what is the problem statement, what is our
requirement and what is the output of the problem solution. All these are included in the
first phase of program development life cycle.

2.Problem Analysis

Here, we determine the requirements like variables, functions, etc. to solve the problem. It
means that we gather the required resources to solve the problem, which are defined in the
problem definition phase. Here, we also determine the bounds of the solution.

3.Algorithm Development

Here, we develop a step-by-step procedure that is used to solve the problem by using the
specification given in the previous phase. It is very important phase for the program
development. We write the solution in step-by-step statements.

4.Coding & Documentation

Here, we use a programming language to write or implement the actual programming


instructions for the steps defined in the previous phase. We construct the actual program in
this phase. We write the program to solve the given problem by using the programming
languages like C, C++, Java, etc.
5.Testing & Debugging

In this phase, we check whether the written code in the previous step is solving the
specified problem or not. This means, we try to test the program whether it is solving the
problem for various input data values or not. We also test if it is providing the desired
output or not.

6.Maintenance

In this phase, we make the enhancements. Therefore, the solution is used by the end-user.
If the user gets any problem or wants any enhancement, then we need to repeat all these
phases from the starting, so that the encountered problem is solved or enhancement is
added.

PROBLEM SLOVING APPROACHES

1.Top-down approach: Most people are familiar with top-down management or problem-
solving strategies. Also known as autocratic leadership, it’s the traditional decision-making
approach you might associate with the manager-employee reporting flow.

In this approach, the entire problem-solving process occurs at the management level, with
information gathering and analysis happening at senior levels. Leaders work backward from a
big-picture goal, identifying milestones and subtasks until they have a plan of action. Once
complete, they communicate their instructions and expectations to team members.

Because of its hierarchical nature and centralized decision-making process, top-down problem-
solving works best across large groups or complex problems. Its rigid organizational structure
maintains order and provides clear direction and accountability.

The top-down strategy works best when:

● You have a complex issue that you need to break down into more manageable parts
● The situation requires a broad understanding of the big picture before the details
● Precise goal-setting needs to occur before you begin working on a solution
● Your team’s eager to solve problems but isn’t sure how to do so
● You need to evaluate and prioritize many potential solutions

Steps in a Top-Down Approach:


1. Identify the Problem: Clearly define the main problem.
2. Decompose: Break down the problem into smaller subproblems or tasks.
3. Define Relationships: Establish how these subproblems relate to one another.
4. Design Solutions: Develop solutions for each subproblem.
5. Implement: Integrate the solutions to form a complete solution.
Example:

Problem: Develop a web application.

● Step 1: Identify the overall goal: Create a functional web application.


● Step 2: Decompose into major components: User Interface, Database, and Server
Logic.
● Step 3: Further break down each component:
○ User Interface: Design, Forms, Navigation
○ Database: Schema Design, Query Handling
○ Server Logic: API Endpoints, Authentication
● Step 4: Design solutions for each subcomponent.
● Step 5: Integrate and implement all parts.

Advantages:

● Clear Structure: Provides a clear overview of the problem and its components.
● Easier Planning: Helps in organizing thoughts and planning effectively.
● Alignment with Goals: Ensures that all efforts are directed toward the main
objective.

2.Bottom-up approach: The bottom-up approach is a democratic system that offers more
collaboration and flexibility, making it perfect for industries requiring iterative change, like
creative fields and software development.

With bottom-up analysis, solutions and implementation happen across the org chart,
emphasizing contributions from the employees who actually work in the field. The lower
echelons of the team can provide valuable input that differs from the managerial
perspective.

The process begins by breaking a challenge into smaller, more manageable parts for
individual contributors to work on. This lets everyone get each component right before
moving on to the next. Once the pieces are complete, you bring them together to form the
big picture: the solution to your problem.

The bottom-up methodology works best in small groups because it’s harder to give every
voice equal consideration on larger teams. Use this approach when:
● The problem’s so complex you can’t fully understand it at the outset
● The problem requires detailed and fundamental knowledge before your team can
move on to higher-level work
● You can’t visualize how each individual component fits together to solve the
problem
● Your team needs to experiment and create iterations of various components to
develop the best solution
Steps in a Bottom-Up Approach:

1. Identify Components: Determine the basic elements or functionalities required.


2. Develop Solutions: Create solutions for these components individually.
3. Test Components: Validate and test each component for functionality.
4. Integrate: Combine the components into a larger system or solution.
5. Refine: Adjust and refine the integrated solution as needed.

Example:

Problem: Create a calculator application.

● Step 1: Identify components: Basic operations (addition, subtraction,


multiplication, division).
● Step 2: Develop solutions for each operation as separate functions.
● Step 3: Test each function independently.
● Step 4: Integrate all functions into a single application with a user interface.
● Step 5: Refine the user experience and functionality based on testing feedback.

Advantages:

● Focus on Functionality: Ensures that each component works well before integration.
● Modular Development: Promotes modularity, making it easier to update or replace
parts of the system.
● Reduced Risk: Problems can be identified and addressed at an early stage.

Comparison of Approaches
Feature Top-Down Approach Bottom-Up
Approach

Starting Point High-level overview Specific components

Focus Overall structure and Individual


goals functionalities

Complexity Breaks complexity into Builds complexity


Management subproblems incrementally

Implementatio Structured and Modular and flexible


n Style organized

Common Use System design, Prototyping, iterative


Cases software architecture development

Problem Solving Techniques

1.ALGORITHM:

A set of sequential steps usually written in Ordinary Language to solve a given problem
is called Algorithm.

It may be possible to solve to problem in more than one ways, resulting in more
than one algorithm. The choice of various algorithms depends on the factors like
reliability, accuracy and easy to modify. The most important factor in the choice
of algorithm is the time requirement to execute it, after writing code in High-level
language with the help of a computer. The algorithm which will need the least
time when executed is considered the best.

Steps involved in algorithm development


An algorithm can be defined as “a complete, unambiguous, finite number of
logical steps for solving a specific problem “

Step1. Identification of input: For an algorithm, there are quantities to be


supplied called input and these are fed externally. The input is to be indentified
first for any specified problem.
Step2: Identification of output: From an algorithm, at least one quantity is
produced, called for any specified problem.

Step3 : Identification the processing operations : All the calculations to be


performed in order to lead to output from the input are to be identified in an
orderly manner.

Step4 : Processing Definiteness : The instructions composing the algorithm must


be clear and there should not be any ambiguity in them.

Step5 : Processing Finiteness : If we go through the algorithm, then for all cases,
the algorithm should terminate after a finite number of steps.

Step6 : Possessing Effectiveness : The instructions in the algorithm must be


sufficiently basic and in practice they can be carries out easily.

An algorithm must possess the following properties

Finiteness: An algorithm must terminate in a finite number of steps


Definiteness: Each step of the algorithm must be precisely and unambiguously
stated
Effectiveness: Each step must be effective, in the sense that it should be primitive
easily convert able into program statement) can be performed exactly in a finite
amount of time.
Generality: The algorithm must be complete in itself so that it can be used to
solve problems of a specific type for any input data.
Input/output: Each algorithm must take zero, one or more quantities as input
data produce one or more output values. An algorithm can be written in English
like sentences or in any standard representation sometimes, algorithm written in
English like languages are called Pseudo Code.

Example
1. Suppose we want to find the average of three numbers, the algorithm is as
follows
Step 1 Read the numbers a, b, c

Step 2 Compute the sum of a, b and c


Step 3 Divide the sum by 3
Step 4 Store the result in variable d
Step 5 Print the value of d

Step 6 End of the program

Algorithms for Simple Problem


2.Write an algorithm to calculate the simple interest using the formula. Simple
interest = P*N* R/100.

Where P is principle Amount, N is the number of years and R is the rate of


interest.
Step 1: Read the three input quantities’ P, N and R.

Step 2 : Calculate simple interest as


Simple interest = P* N* R/100
Step 3: Print simple interest.
Step 4: Stop.

3. Write an algorithm to find the area of the triangle.


Let b, c be the sides of the triangle ABC and Athe included angle between the
given sides.
Step 1: Input the given elements of the triangle namely sides b, c
and angle between the sides A.
Step 2: Area = (1/2) *b*C* sin
Step 3: Output the Area
Step 4: Stop.

4.Write an algorithm to find the largest of three numbers X, Y,Z.


Step 1: Read the numbers X,Y,Z.
Step 2: if (X > Y)
Big = X
else BIG = Y
Step 3 : if (BIG < Z)

Step 4: Big = Z
Step 5: Print the largest number i.e. Big
Step 6: Stop.
5.Write down an algorithm to find the largest data value of a set of given data
values

Step 1: LARGE ← 0

Step 2: read NUM


Step 3: While NUM > = 0 do
if NUM > LARGE
then

3.1.1.1 LARGE ← NUM

3.2. read NUM


Step 4: Write “largest data value is”, LARGE

Step 5: end.

2.FLOWCHART:
A flow chart is a step by step diagrammatic representation of the logic paths to
solve a given problem. Or Aflowchart is visualor graphical representation of an
algorithm.
The flowcharts are pictorial representation of the methods to b used to solve a
given problem and help a great deal to analyze the problem and plan its solution
in a systematic and orderly manner. A flowchart when translated in to a proper
computer language, results in a complete program.

Advantages of Flowcharts
1. The flowchart shows the logic ofa problem displayed in pictorial
fashion which felicitates easier checking of an algorithm.
2. The Flowchart is good means of communication to other users. It
is also a compact means of recording an algorithm solution to a problem.
3. The flowchart allows the problem solver to break the problem
into parts. These parts can be connected to make master chart.
4. The flowchart is a permanent record of the solution which can be
consulted at a later time.

Differences between Algorithm and Flowchart


Algorith Flowchart
m
Flowchart is diagrammatic representation
A method of representing the step- of an algorithm. It is constructed using
by-step logical procedure for different types of boxes and symbols.
solving a problem The flowchart employs a series of blocks
It contains step-by-step English and arrows, each of which represents a
descriptions, each step particular step in an algorithm
representing a particular operation These are useful for detailed
leading to solution of problem representations of complicated programs
These are particularly useful for For complex programs, Flowcharts prove to
small problems be adequate
For complex programs, algorithms
prove to be Inadequate

SYMBOLS USED IN FLOW CHART

The symbols that we make use while drawing flowcharts as given below are as per
conventions followed by International Standard Organization (ISO).

Oval: Rectangle with rounded sides is used to indicate either START/ STOP of the
program. ..

Input and output indicators: Parallelograms are used to represent input and
output operations. Statements like INPUT, READ and PRINT are represented in
these Parallelograms.

Process Indicators: - Rectangle is used to indicate anyset of processing operation


such as for storing arithmetic operations.

Decision Makers: The diamond is used for indicating the step of decision making
and therefore known as decision box. Decision boxes are used to test the
conditions or ask questions and depending upon the answers, the appropriate
actions are taken by the computer. The decision box symbol is

Flow Lines: Flow lines indicate the direction being followed in the flowchart. In a
Flowchart, every line must have an arrow on it to indicate the direction. The
arrows may be in any direction

On- Page connectors: Circles are used to join the different parts of a flowchart
and these circles are called on-page connectors. The uses of these connectors
give a neat shape to the flowcharts. Ina complicated problems, a flowchart may
run in to several pages. The parts of the flowchart on different
pages are to be joined with each other. The parts to be joined are indicated bythe

circle.

Off-page connectors: This connector represents a break in the path of flowchart


which is too large to fit on a single page. It is similar to on-page connector. The
connector symbol marks where the algorithm ends on the first page and where it
continues on the second.

Simple Problems using Flow Chart


Draw the Flowchart for the following
1.Draw the Flowchart to add two numbers.
2.Draw a flowchart to find out the biggest of the three unequal positive numbers.

3.Draw a flowchart to find the factorial of given positive integer N.


4.Draw a flowchart to find the area of triangle.
3.PSEUDO CODE:

The Pseudo code is neither an algorithm nor a program. It is an abstract form of a


program. It consists of English like statements which perform the specific
operations. It is defined for an algorithm. It does not use any graphical
representation. In pseudo code, the program is represented in terms of words and
phrases, but the syntax of program is not strictly followed.
Advantages:

* Easy to read.

* Easy to understand.

* Easy to modify.

Example: Write a pseudo code to perform the basic arithmetic operations.


Read n1, n2
Sum = n1 + n2
Diff = n1 – n2
Mult = n1 * n2
Quot = n1/n2
Print sum, diff, mult, quot
End.

Real-World application of Problem Sloving


Problem-solving skills are essential in many real-world contexts. Here are a few
applications:
1. Business: Companies often face challenges like declining sales or inefficiencies.
Using problem-solving techniques, managers can analyze data, identify root causes,
and implement strategies to improve performance.
2. Healthcare: Medical professionals use problem-solving to diagnose conditions.
They assess symptoms, order tests, and interpret results to devise effective
treatment plans.
3. Education: Teachers encounter diverse learning needs in the classroom. By
identifying the challenges students face, they can adapt their teaching methods and
materials to better support each learner.
4. Engineering: Engineers solve complex technical issues during design and
construction. They apply critical thinking to troubleshoot problems, ensuring
projects meet safety and quality standards.
5. Everyday Life: Individuals face daily challenges, from budgeting to time
management. Problem-solving helps prioritize tasks, find creative solutions, and
make informed decisions.
6. Environmental Issues: Scientists and activists work to address climate change and
resource depletion. They analyze data, model scenarios, and develop sustainable
practices to mitigate negative impacts.
These examples illustrate how effective problem-solving can lead to innovative solutions
and improvements across various fields.

You might also like