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

Algorithms_an_Programming

The document discusses algorithms, defining them as a set of instructions for solving problems in programming. It explains key programming concepts such as variables, data structures like arrays and lists, and the software development cycle, including the Agile model. The document provides examples and characteristics of these concepts to illustrate their importance in software development.
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
0% found this document useful (0 votes)
5 views

Algorithms_an_Programming

The document discusses algorithms, defining them as a set of instructions for solving problems in programming. It explains key programming concepts such as variables, data structures like arrays and lists, and the software development cycle, including the Agile model. The document provides examples and characteristics of these concepts to illustrate their importance in software development.
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
You are on page 1/ 23

Algorithms in Programming

Dr. BHISAJI C SURVE


What is Algorithm………….
• An algorithm is a set of well-defined instructions or rules designed to
perform a specific task or solve a particular problem.
• In computer science, algorithms are essential for developing software
and applications as they determine how data is processed and tasks
are executed.
• An algorithm can range from a simple, straightforward procedure to a
complex series of operations. They are often written in pseudocode or
programming languages .
Finding the Largest Number Algorithm
Steps:
• Start with a list of numbers. For example, [2, 7, 1, 8, 5].
• Assume the first number in the list is the largest. Let's call this
largest_number. So, largest_number = 2.
• Go through each number in the list one by one:
• Compare each number with largest_number.
• If a number is greater than largest_number, update largest_number to
be this greater number.
• After checking all the numbers, largest_number will be the largest
number in the list.
• Example:

Let's go through the list [2, 7, 1, 8, 5] step-by-step:

• Start by assuming the first number is the largest:

• largest_number = 2
• Compare 7 with largest_number:

• Since 7 > 2, update largest_number = 7


• Compare 1 with largest_number:

• Since 1 < 7, keep largest_number = 7


• Compare 8 with largest_number:

• Since 8 > 7, update largest_number = 8


• Compare 5 with largest_number:

• Since 5 < 8, keep largest_number = 8


Variable
• In programming, a variable is a fundamental concept that represents a
storage location in a computer’s memory, which holds data that can be
changed during program execution. Think of variables as containers or
boxes, where each container has a unique name and is capable of
storing a value.
Key Characteristics of Variables:
Name: Every variable has a unique name (or identifier), which is used to refer to the value it holds. The name should
be meaningful to make the code easier to understand.

Type: Variables have types that define what kind of data they can store. Common data types include:
• Integers (int): Whole numbers.
• Floating-point numbers (float or double): Numbers with fractional parts.
• Characters (char): Single text characters.
• Strings: Sequences of characters (handled as arrays of chars in C or as a distinct type in other languages).
• Booleans (bool): True or false values.

Value: The actual data stored in the variable. This value can change during the execution of the program, hence the
name "variable."

Scope: The region of the program where the variable is accessible. For example, a variable declared inside a function
is local to that function and not accessible outside it.

Lifetime: The duration for which the variable exists in memory. For example, local variables typically exist only during
the execution of a block of code in which they are defined.
Example in Context:

Imagine you're managing a small inventory system using a program. You


might have variables like:

• int numberOfItems = 100; - This stores the number of items in


stock.
• float itemPrice = 19.99; - This holds the price of an item.
• char currencySymbol = '$’; - This stores a single character
representing the currency.
• bool isAvailable = true; - This indicates whether the item is
available for purchase.
If-else
• # Assume we have a boolean variable `isRaining`
• isRaining = True # or set to False depending on the
condition

• if isRaining:
• print("Bring an umbrella.")
• else:
• print("No need for an umbrella.")
Loops:
Data structure:
• An Array is a data structure that can hold multiple values of the same type,
arranged in a list that can be indexed. It's like a row of storage boxes where each
box holds a value, and each box is identified by an index or position number.

Key Characteristics of Arrays:


• Fixed Size: The size of an array is defined at the time of its creation and cannot be
changed.

• Uniform Data Type: All elements in an array must be of the same data type (e.g.,
all integers, all floats, etc.).

• Indexed Access: Each element in the array can be accessed using its index,
starting from zero. For example, the first element is at index 0, the second element
at index 1, and so on.
• In Python, a list is a versatile data structure that allows you to store a sequence
of values. Unlike arrays in some other programming languages, lists in Python
can contain elements of different data types, and they are dynamic, meaning
their size can change.
Key Features of Python Lists:
• Dynamic Size: Lists can grow or shrink in size as needed. You can add or
remove elements after the list is created.
• Mixed Data Types: Lists can store elements of different types simultaneously,
such as integers, strings, floats, or even other lists.
• Indexed Access: Similar to arrays, elements in a list can be accessed using
their index, with indexing starting from 0.
Software/ System
Development Cycle

• ISO/IEC 12207

Chapter 5
Analysis
• Feasibility study
• Resource planning
• Defining scope
• Function requirements
• Technical requirements
• Set objective and Goals
Design

• Logical system design

• Physical design

• Coding
Implementation

• Hardware interface

• Front end interface

• Back end – Front end interface


Testing

• Unit level testing

• Integrated testing

• Parallel run

• User acceptance testing


Deployment

• Go-live

• Review
Maintenance

• Preventive maintenance

• Corrective maintenance
AGILE MODEL
• The meaning of Agile is swift or versatile. “Agile
process model” refers to a software development
approach based on iterative development. Agile
methods break tasks into smaller iterations, or
parts do not directly involve long-term planning.
• Plans regarding the number of iterations, the
duration and the scope of each iteration are
clearly defined in advance.
• Each iteration is considered as a short time
“frame” in the Agile process model, which
typically lasts from one to four weeks.
Thanks…………..

You might also like