100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
My inspiration is sir apj.abdul kalam $52.83
Add to cart

Class notes

My inspiration is sir apj.abdul kalam

 0 view  0 purchase

"Providing a *complete, well-written description* of your document plays a crucial role in making it discoverable to others. A good description not only helps users understand what your document is about but also significantly increases its chances of being found through search engines or document ...

[Show more]

Preview 4 out of 117  pages

  • January 5, 2025
  • 117
  • 2024/2025
  • Class notes
  • Mani rajan
  • All classes
All documents for this subject (2)
avatar-seller
darksri1488
NOTES OF LESSON
GE3151- PROBLEM SOLVING AND
PYTHON PROGRAMMING

, UNIT I ALGORITHMIC PROBLEM SOLVING

INTRODUCTION

PROBLEM SOLVING
Problem solving is the systematic approach to define the problem and creating number of
solutions.
The problem solving process starts with the problem specifications and ends with a
correct program.
PROBLEM SOLVING TECHNIQUES
Problem solving technique is a set of techniques that helps in providing logic for solving a
problem.
Problem solving can be expressed in the form of
1. Algorithms.
2. Flowcharts.
3. Pseudo codes.
4. Programs
1.ALGORITHM
It is defined as a sequence of instructions that describe a method for solving a problem.
In other words it is a step by step procedure for solving a problem

• Should be written in simple English
• Each and every instruction should be precise and unambiguous.
• Instructions in an algorithm should not be repeated infinitely.
• Algorithm should conclude after a finite number of steps.
• Should have an end point
• Derived results should be obtained only after the algorithm terminates.

Qualities of a good algorithm

The following are the primary factors that are often used to judge the quality of the
algorithms.
Time – To execute a program, the computer system takes some amount of time. The lesser
is the time required, the better is the algorithm.
Memory – To execute a program, computer system takes some amount of memory space.
The lesser is the memory required, the better is the algorithm.
Accuracy – Multiple algorithms may provide suitable or correct solutions to a given
problem, some of these may provide more accurate results than others, and such algorithms may be
suitable

Building Blocks of Algorithm
As algorithm is a part of the blue-print or plan for the computer program. An algorithm is
constructed using following blocks.
• Statements
• States
• Control flow
• Function



2

,Statements
Statements are simple sentences written in algorithm for specific purpose. Statements may
consists of assignment statements, input/output statements, comment statements
Example:
• Read the value of ‘a’ //This is input statement
• Calculate c=a+b //This is assignment statement
• Print the value of c // This is output statement
Comment statements are given after // symbol, which is used to tell the purpose of the line.

States
An algorithm is deterministic automation for accomplishing a goal which, given an initial
state, will terminate in a defined end-state.
An algorithm will definitely have start state and end state.

Control Flow
Control flow which is also stated as flow of control, determines what section of code is to
run in program at a given time. There are three types of flows, they are
1. Sequential control flow
2. Selection or Conditional control flow
3. Looping or repetition control flow

Sequential control flow:
The name suggests the sequential control structure is used to perform the action one after
another. Only one step is executed once. The logic is top to bottom approach.
Example
Description: To find the sum of two numbers.
1. Start
2. Read the value of ‘a’
3. Read the value of ‘b’
4. Calculate sum=a+b
5. Print the sum of two number
6. Stop
Selection or Conditional control flow
Selection flow allows the program to make choice between two alternate paths based on
condition. It is also called as decision structure
Basic structure:
IFCONDITION is TRUE then
perform some action
ELSE IF CONDITION is FALSE then
perform some action
The conditional control flow is explained with the example of finding greatest of two
numbers.
Example
Description: finding the greater number
1. Start
2. Read a

3

, 3. Read b
4. If a>b then
4.1. Print a is greater
else
4.2. Print b is greater
5. Stop

Repetition control flow
Repetition control flow means that one or more steps are performed repeatedly until some
condition is reached. This logic is used for producing loops in program logic when one one more
instructions may need to be executed several times or depending on condition.
Basic Structure:
Repeat untilCONDITIONis true
Statements
Example
Description: to print the values from 1 to n
1. Start
2. Read the value of ‘n’
3. Initialize i as 1
4. Repeat step 4.1 until i< n

4.1. Print i
5. Stop

Function
A function is a block of organized, reusable code that is used to perform a single, related
action. Function is also named as methods, sub-routines.
Elements of functions:
1. Name for declaration of function
2. Body consisting local declaration and statements
3. Formal parameter
4. Optional result type.
Basic Syntax
function_name(parameters)
function statements
end function




Algorithm for addition of two numbers using function
Main function()
Step 1: Start
Step 2:Call the function add()
Step 3: Stop
sub function add()
Step1:Functionstart

4

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller darksri1488. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $52.83. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

48756 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 15 years now

Start selling
$52.83
  • (0)
Add to cart
Added