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

class_11cs_unit2_Computational_Thinking_and_Programming_–_1_Part (5)

Unit II of the Class XI Computer Science curriculum focuses on computational thinking and programming, emphasizing problem-solving steps such as analyzing the problem, developing algorithms, coding, testing, and debugging. It introduces algorithm representation methods like flowcharts and pseudocode, highlighting their importance in guiding programmers. Additionally, the unit covers decomposition, which involves breaking down complex problems into smaller, manageable sub-problems for easier resolution.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

class_11cs_unit2_Computational_Thinking_and_Programming_–_1_Part (5)

Unit II of the Class XI Computer Science curriculum focuses on computational thinking and programming, emphasizing problem-solving steps such as analyzing the problem, developing algorithms, coding, testing, and debugging. It introduces algorithm representation methods like flowcharts and pseudocode, highlighting their importance in guiding programmers. Additionally, the unit covers decomposition, which involves breaking down complex problems into smaller, manageable sub-problems for easier resolution.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Unit II

Computational Thinking and


Programming – 1
(PART -1 )

CLASS XI COMPUTER SCIENCE


CODE 083
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Unit II: Computational Thinking and Programming – 1


Introduction to problem solving:
• Steps for problem solving (analysing the
problem, developing an algorithm, coding,
testing and debugging).
• Representation of algorithms using flow
chart and pseudo code, decomposition
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Introduction to problem solving:


• Problem solving is the process of
identifying a problem, developing an
algorithm for the identified problem and
finally implementing the algorithm to
develop a computer program
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Steps for Problem Solving


SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Step 1. Analysing the problem


• we need to read and analyze the problem statement
carefully in order to list the principal components of
the problem and decide the core functionalities that
our solution should have.

• By analyzing a problem, we would be able to figure


out what are the inputs that our program should
accept and the outputs that it should produce.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Step 2 .Developing an Algorithm


• A set of exact steps which when followed, solve the
problem or accomplish the required task is called
algorithm

• The computer follows the steps written in the program


code. Therefore, the programmer first prepares a roadmap
of the program to be written, before actually writing the
code.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Step 3 .Coding
• Coding is the process of transforming ideas, solutions,
and instructions into the language that the computer can
understand.

• After finalizing the algorithm, we need to convert the


algorithm into the format which can be understood by the
computer to generate the desired solution.

• Different high level programming languages can be used


for writing a program like python , java , php etc.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Step 4 . Testing and Debugging


• Testing is used at key checkpoints in the overall process to
determine whether objectives are being met.

• Debugging is the process of locating and removing coding


mistakes in computer programs

• The errors or defects found in the testing phases are


debugged or rectified and the program is again tested. This
continues till all the errors are removed from the program.
Algorithm
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

• An algorithm is a set of instructions for solving a problem or


accomplishing a task.

• One common example of an algorithm is a recipe, which consists of


specific instructions for preparing a dish or meal.

Algorithm for making tea :


1. Put pan on gas
2. Light up the gas
3. Put some water
4. Add Tea leaves
5. Add milk
6. Boils all ingredients
7. Tea is ready serve it
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Why do we need an Algorithm?


• A programmer writes a program to instruct the computer to
do certain tasks as desired. The computer then follows the
steps written in the program code.

• Therefore, the programmer first prepares a roadmap of the


program to be written, before actually writing the code
without a roadmap, the programmer may not be able to
clearly visualize the instructions to be written and may end up
developing a program which may not work as expected.

• Such a roadmap is nothing but the algorithm which is the


building block of a computer program.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Representation of Algorithms
• Once the steps are identified, the need is to write down
these steps along with the required input and desired
output.
• There are two common methods of representing an
algorithm —flowchart and pseudo code.
• To represent an algorithm keep in mind the following:
1. It showcases the logic of the problem solution, excluding
any implementation details
2. It clearly reveals the flow of control during execution of
the program
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Flowchart —Visual Representation of Algorithms


• A flowchart is a visual representation of an
algorithm.
• A flowchart is a diagram made up of boxes,
diamonds and other shapes, connected by
arrows.
• Each shape represents a step of the solution
process and the arrow represents the order or
link among the steps
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Shapes or symbols to draw flow charts


SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Write an algorithm to find the square of a number


Before developing the algorithm, let us first identify
the input, process and output:
• Input: Number whose square is required
• Process: Multiply the number by itself to get its
square
• Output: Square of the number

Algorithm to find square of a number.

• Step 1: Input a number and store it to num


• Step 2: Compute num * num and store it in square
• Step 3: Print square
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Pseudo code
• A pseudocode (pronounced Soo-doh-kohd) is another way of
representing an algorithm.

• The word “pseudo” means “not real,” so “pseudocode” means


“not real code

• It is considered as a non-formal language that helps


programmers to write algorithm.

• It is a detailed description of instructions that a computer


must follow in a particular order. It is intended for human
reading and cannot be executed directly by the computer.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Pseudo code Keywords


• Following are some of the frequently used keywords
while writing pseudocode:
• INPUT
• COMPUTE
• PRINT
• INCREMENT
• DECREMENT
• IF/ELSE
• WHILE
• TRUE/FALSE.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Write an algorithm to display the sum of two numbers entered by


user, using both pseudo code and flowchart.

• input num1
• input num2
• COMPUTE Result = num1 + num2
• PRINT Result
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Decomposition
• The process of dividing a complex problem in smaller sub
problems is called decomposition.

• These sub problems are relatively easier to solve than the


original problem.

• Finally, the sub problems are combined in a logical way to


obtain the solution for the bigger, main problem.
SUBSCRIBE HAMARI ACADEMY ON YOUTUBE

Decomposition Example
• School Management System

Teacher management

School management
Student management

Transport management

Library management

Sports management

Fees management
THANKS FOR WATCHING..
DON’T FORGET TO SUBSCRIBE
SHARE WITH FRIENDS ALSO

You might also like