Unit - I
Unit - I
FACULTY OF SCIENCE
DEPARTMENT OF COMPUTER SCIENCE
CA3CO01
PROBLEM SOLVING AND PROGRAMMING
Unit-I
Problem Solving Methodology
BOOKS TO BE REFERRED
• Text Books
1. R.G. Dromey, How to Solve it by Computer, Pearson Education
2. B.W. Kernighan and D. M. Ritchie, The C Programming Language, Pearson Education.
3. B. Gottfried, Programming with C , 2nd Edition, (Indian Adapted Edition), TMH .
• References Books
1. H. Schildt C, The Complete Reference, Tata McGraw Hill.
2. E. Balaguruswamy, Programming in C, Tata McGraw Hill.
3. Y. Kanetkar, Let us C, BPB Publications.
4. Practical C Programming, 3rd Edition, A Nutshell Handbook O’Relly.
5. A. N Kamthaneet. al, Computer Programming and IT, Pearson Education, 2011.
Programming is a problem solving activity. When you write a program, you
are actually writing an instruction for the computer to solve something for
you.
into a solution by using our knowledge of the problem domain and by relying
on our ability to select and use appropriate problem-solving strategies,
An effective problem solver will take the opinions of everyone involved into account.
The problem-solving steps support the involvement of interested parties, the use of factual information, comparison of
expectations to reality, and a focus on root causes of a problem.
1. Financial Analysis
2. Time Limit Analysis
3. Technical Analysis and
4. Operational Analysis
DESIGN A SOLUTION
A design defines all the architectural modules of the product along with its communication and data flow
representation with the external and internal modules. The external and internal design should be clearly
defined in Data Definition Document.
Once the design process is successfully done. Then comes the testing phase. Testers test
the well defined codes written during Design Process and they intend to find the bugs in it.
Successful testing defines the error-free codes.
Once the product is tested and results successfully then it is ready to be deployed. It is released
formally to the customer. Sometimes product deployment happens in stages as per the business strategy
of that organization. The product may first be released in a limited segment and tested in the real
business environment - Beta (β) testing). After based on the results of Beta Testing and feedback, the
product may be released as it is or with suggested enhancements in the targeting market segment.
Then
After the product is released in the market, its maintenance is done for the existing customer base.
DESIGN TOOLS
• Algorithm
• Flowchart
• Coding
ALGORITHM
An algorithm is a step-by-step method for solving a problem. An algorithm refers to a set of instructions that define
the execution of work to get the expected results. To make the program work properly, we must have to properly
design the algorithm. Designing the algorithm helps to utilize the computing resources effectively.
Before solving a problem, one should know what to do, how to do it, and what types of steps should be taken.
The algorithms are written in natural language or in plain English language. We can represent algorithms
via flowcharts, pseudo code, and others..
Algorithm is a proper technique that illustrates the right solution in logical and feasible steps. Algorithm is normally
done in the form of flowcharts and pseudo codes.
•Recursive algorithms.
•Dynamic programming algorithm.
•Backtracking algorithm.
•Greedy algorithm.
•Brute Force algorithm.
Example: Write an algorithm to prepare a cup of tea.
Example: Write an algorithm to print the numbers from 1 to 20.
Step 5: Exit.
Example: The Algorithm to Find the sum two numbers N and M
Step 2: Sum them and save the result in the variable sum.
Step 1: x = 0,
Step 2: x = x + 1
Step 3: Print x
Step 4: If ‘x < 20,
•Proper debugging
•Effective analysis •Time-consuming
•Efficient coding •Complex
•Proper documentation •Difficult to modify
•Efficient program maintenance •It has no standard
Major
Symbols
Used
In
Flowchart
Symbols
Used
In
Flowchart
Three Most Commonly Used Types of Flowcharts
•Process Flowchart
•Data Flowchart
•Improves the readability of any approach. It’s one of the best approaches to start implementation of an algorithm.
•Acts as a bridge between the program and the algorithm or flowchart. Also works as a rough documentation, so the
program of one developer can be understood easily when a pseudo code is written out. In industries, the approach of
documentation is essential. And that’s where a pseudo-code proves vital.
•The main goal of a pseudo code is to explain what exactly each line of a program should do, hence making the code
construction phase easier for the programmer.