100% found this document useful (1 vote)
21 views5 pages

Problem Solving in Computer Science

Uploaded by

paiprashanth92
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
21 views5 pages

Problem Solving in Computer Science

Uploaded by

paiprashanth92
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Introduction to problem solving

What is computer science?

“Computer science is a science of abstraction creating right model for for a problem and
devising appropriate mechanisable technique to solve it”

● Computers do jobs in faster and accurate manner

● A precise step- by-step set of instructions used to solve a problem-(definition for


algorithm)

● A clear definition, design of solution, and implementation of the design using a


programming language are the key factors that decides a successful computer
based problem solving

definition of problem solving


“ It is the process of identifying a problem, developing an algorithm for the problem
identified and implementing the algorithm in a programming language”
(or)
“ it is the process of identifying devising and implementing an algorithm for transforming
a less desirable condition that is the set of data to a more desirable one that is
information”

What is Garbage In Garbage Out? (GIGO)


It means the correctness of a program output depends upon the correctness of the input
provided.

For example: if we have a program to add three single digit numbers then if at least one
of the inputs contains special characters or alphabets it leads to wrong output however
good the algorithm is.

a. A problem solving always begins with identification of the problem that is problem
definition

b. It ends with a working solution in the form of a program called software


a. Problem definition
b. Problem analysis
c. Algorithm development
d. Coding
e. Testing and debugging
( draw figure 4.1 of text book and explain)

a. Analysis of the problem


1. It gives a clear understanding of the problem
2. It is noted that incorrect analysis failed give a correct solution
3. A proper study or analysis of the problem always helps us to identify the
various components in our expected new system
4. Systematic analysis will be helpful to figure out the proper inputs and the
required output.

b. Developing an algorithm
1. At this stage a solution to a problem is devised in a natural language
2. The solution is provided in the form of a precise
step-by-step set of called an algorithm
3. The tentative algorithm obtained is successively refined to capture all the
expects of the desired solution
4. It is possible to have more than one algorithm for a problem but our job is
to select the most suitable one which leads to the desired solution
5. An algorithm can be represented either by a pseudocode or flowchart

c. Coding
1. At this stage we convert the selected algorithm into a format
understandable to the computer to generate the desired solution
2. Coding can be done either using high level languages like C/C++ /Java/
Python etc.
It can be in low level like Assembly language also.

d. Testing and debugging


1. The programs are tested based on to various parameters, to know whether
it mat the requirements of the user
2. During testing we measure the overall time taken and the correctness of
the output for all possible inputs.
3. The logical errors are checked for wrong outputs
4. The errors are debugged and rectified. The program then is tested again.
This process continues until all errors are rectified or fixed.

Software testing methods:


a. Unit testing/component testing
/module testing
b. Integration testing
c. System testing
d. Acceptance testing

Note: Customer support is the very important stage in problem solving, here the
software vendor team continuously spends time to fix bugs which appear in the
operational field.
Algorithm
Definition:
● A precise step- by-step set of instructions used to solve a problem

Algorithm is the first step in programming

Purpose:
a. Increased readability
b. Achieving accuracy
c. To obtain efficient solution

Characteristics of good algorithm

● Input : Every algorithm should receive some input, so as to make the system
open.

● Precision that is the definiteness


It means the steps in the algorithm are very clear and in detail.
The definitions should be correct and free from ambiguities

● Uniqueness:
It refers to the effectiveness of
the algorithm, that is every step should be uniquely defined and the output of each
step depends only on the result of preceding step(s) and the initial inputs.

● Finiteness :
An algorithm should terminate after a definite number of steps.

● Output : Every algorithm should produce an output so as to make the system


open.

What are the most important things to be identified while writing an algorithm?
● User input
● Computational process
● Output desired by the user

what are the things to be remembered while writing pseudo code or drawing a flow chart
represent an algorithm?

● Focus on logic of solving a problem rather than implementation details.

● Flow of control should be revealed clearly during execution of the program

Flow chart :
Definition:A flowchart is defined as a diagrammatic (visual) representation of an
algorithm

What are the geometrical symbols used to make a flowchart? Explain


Flowchart uses geometrical symbols like ellipse/oval shape, rectangle, rhombus,
diamond, parallelogram, hexagon, circle and arrows

Ellipse/oval represents the functions start/end [Link] is also called terminator symbol

Rectangle represents the function process. It is an action symbol. An action or a process


is also known as computation. Every rectangle will represent only one step of an
algorithm.

Diamond represents a decision.


The diamond symbol in a flowchart represents a branching point.
A true/false yes/no type of question is raised at the decision point and the path get split
into two branches based on the answer.
This symbol is also used in the implementation of a while loop or do while loop in an
algorithm.

The parallelogram represents input and output.


This is also called data symbol

—------------->
Arrow represents the order/direction of flow between one one shape and another shape
representing a step in an algorithm.
The hexagon represents preparation or iteration. The symbol is very much helpful to
represent fixed execution loops in an algorithm.

The Circle acts as a connector between two predefined processes or subroutine.


It is also used as a feeder of loop control variables back to the hexagon in iterative
process.
ಮುಂದುವರಿಯುತ್ತದೆ……..

Common questions

Powered by AI

Problem solving in computer science involves several critical components: problem definition, problem analysis, algorithm development, coding, and testing/debugging . Problem definition is essential for understanding what needs to be solved. In problem analysis, a clear understanding is obtained which avoids incorrect solutions . Algorithm development provides a step-by-step solution plan that can be refined until it meets desired outcomes . Coding then converts this plan into a format that computers can execute, enabling the generation of solutions . Testing and debugging ensure that the solution meets user requirements and is free of errors .

The structured process of algorithm development allows for devising multiple solution approaches by refining initial ideas through detailed step-by-step instruction formulation. This leads to varied algorithms as each developer might interpret the problem uniquely, employ different data structures, or optimize for various factors like speed or memory use. The criteria for selecting the most suitable algorithm include efficiency, ease of implementation, resource consumption, and clarity. Ultimately, the chosen algorithm should best meet problem requirements and constraints, ensuring the optimal problem resolution .

The GIGO principle emphasizes that the quality of input data directly affects the quality of output generated by a program. If input data is incorrect, even if the algorithm is perfect, the output will be flawed. For instance, if special characters or alphabets are entered where only numerical input is expected, it will lead to incorrect outputs .

When drafting pseudocode or creating a flowchart, focus on the logic of problem-solving rather than implementation specifics. In pseudocode, clarity is achieved through straightforward language, logical structuring, and detail disclosure necessary for algorithm execution. In flowcharts, using clear symbols like ovals for start/end, rectangles for processes, and diamonds for decisions ensures an intuitive visual representation. Parallelograms illustrate data input/output, while arrows indicate flow direction. These elements contribute by making the algorithm understandable to stakeholders without requiring detailed technical knowledge .

Flowcharts play a critical role in understanding and communicating algorithms by providing a clear, visual depiction of each process step and decision point in the algorithm's execution. The use of standardized symbols like ovals for start/end, rectangles for processes, diamonds for decisions, and arrows for flow direction helps in visualizing the logical sequence and interactions within the algorithm. This aids in recognizing potential issues, improving interpretation across diverse groups, and efficiently communicating complex processes to stakeholders .

Testing and debugging are critical in verifying that software functions correctly and meets user needs. They involve identifying and fixing errors to ensure software reliability. Testing methods include unit testing for individual components, integration testing for combined components, system testing for overall performance, and acceptance testing for user requirements. During these tests, the correctness of outputs and performance under various conditions are checked. Errors are debugged and fixed in a cycle until all issues are resolved .

A good algorithm possesses several key characteristics: input requirements, precision, uniqueness, finiteness, and output generation. Each contributes to reliability in computation. Input ensures the system has starting data. Precision requires clear and unambiguous steps, preventing misunderstandings. Uniqueness guarantees each step has a single outcome, ensuring task predictability. Finiteness means the algorithm will terminate, avoiding infinite loops. Finally, output assures the algorithm fulfills its task, demonstrating its purpose .

Customer support is crucial in the problem-solving lifecycle as it ensures software usability in real-world conditions and long-term client satisfaction. It involves fixing bugs that arise during operational use, addressing user queries, and providing guidance on software functionality. Effective support helps in identifying overlooked issues during testing phases, leading to iterative improvements. It also fosters a positive user experience, maintaining the software's reputation and reliability .

Systematic problem analysis is vital as it provides a detailed understanding of the problem, preventing flawed solutions. By identifying components of the new system, correct inputs, and required outputs, it ensures all aspects are considered before development. If analysis is incomplete or incorrect, it can lead to failures in meeting project objectives or inefficiencies, thereby jeopardizing the success of a project. Thus, thorough analysis is foundational to devising effective and functional computer-based solutions .

Testing various input scenarios during debugging is important to expose different program responses and ensure its robustness against unexpected conditions. Assessing multiple input cases checks how software handles valid, boundary, and invalid inputs, revealing logical errors and potential crash points. This rigorous testing enhances software reliability by confirming that it performs as intended in different situations, thereby reducing the risk of failure after deployment .

You might also like