Programming Process
Programming Process
Program:
Program is the set of instructions which is run by the computer to perform specific task.
The task of developing program is called programming.
Problem definition:
“It is an action to identify the problem, to understand the problem, and to
understand any Constraints that may be the limits of the solution.”
In this we understand the problem for which the program has to be developed.
That is, the problem is identified and understood in this.
To solve a problem through computer one has to go through certain steps. Such
as follows,
The end result of this step is a detailed review of the sequence of actions taken
to solve a problem.
3. Developing Solutions:
Here an overview of the sequence of operations resulting from the analysis
phase is extended to a step-by-step solution to the problem in question.
4. Coding and Implementation:
The final step in problem solving is to translate the detailed sequence of
operations into a language that the computer can understand. Here each
step is converted into its equivalent instruction or instruction in the
computer language which has been selected for implantation.
What is an algorithm in C?
An algorithm in C is a step-by-step procedure to solve a specific problem or perform a
task, implemented using the C programming language. It's a set of instructions that
takes some input, processes it, and produces an output. In C, algorithms are typically
implemented as functions or a series of functions that work together to achieve a goal.
Uses of Algorithm
Algorithms are essential in both programming and various other fields. Here are some
key uses:
1. Sorting and Searching Data: Algorithms like Quick Sort or Binary Search are used to
organize data and find specific items efficiently.
2. Performing Mathematical Calculations: Algorithms such as those for computing
factorials, prime numbers, or solving equations are fundamental in both simple and
complex mathematical tasks.
3. Processing and Analyzing Large Datasets: Data processing algorithms, including those
for data mining and statistical analysis, help in extracting valuable insights from large
amounts of data.
4. Optimizing Resource Allocation: Algorithms in operations research help in optimizing
resources like scheduling, inventory management, and network design.
5. Solving Complex Problems: In fields like artificial intelligence and machine learning,
algorithms are used to train models, make predictions, and automate decision-making.
6. Automating Decision-Making Processes: Decision-making algorithms are used in
applications such as recommendation systems, financial trading, and automated customer
support.
7. Improving Efficiency in Various Industries: Algorithms enhance efficiency in logistics
(routing and scheduling), finance (portfolio management), and other sectors by optimizing
processes and reducing costs.
Need for Algorithms
Algorithms are essential in programming for several reasons:
1. Efficiency: They help create faster, more optimized code
2. Scalability: Well-designed algorithms can handle increasing amounts of data
3. Problem-solving: They provide structured approaches to tackle complex issues
4. Consistency: Algorithms ensure reliable and repeatable results
5. Abstraction: They allow programmers to focus on high-level problem-solving rather than
low-level details
6. Reusability: Once developed, algorithms can be applied to similar problems across
different domains
7. Performance analysis: Algorithms provide a basis for comparing different solutions to the
same problem
Features of the Algorithm
Algorithms in C programming are distinguished by several key features that make them
fundamental to creating effective & efficient software. Here’s a detailed look at these
features:
Definiteness: Each step of an algorithm is clear & unambiguous. In C programming, this
means that every operation, from variable declaration to loops and conditionals, must be
precisely defined to avoid errors during execution.
Finiteness: Algorithms must have a finite number of steps. This ensures that they
eventually terminate & produce a result after executing their defined steps a certain
number of times.
Input: Algorithms take zero or more inputs. In the context of C programming, these inputs
could be data like numbers, array elements, or any valid data type, provided to the
algorithm to process a specific task.
Output: For every input, an algorithm should produce at least one output. This output is
the result of processing the given inputs through the set of well-defined instructions.
Generality: The algorithm should be applicable to a set of problems rather than a single
problem. This means the algorithm can solve general cases and isn't tailored to specific
inputs.
Algorithm:
Algorithm is the set of rules that define how particular problem can be solved in finite
number of steps. Any good algorithm must have following characteristics
Advantages of Algorithms:
Disadvantage of Algorithms:
1. It is time consuming
2. Difficult to show branching and looping statement
3. Large problems are difficult to implement
Flowchart:
The solution of any problem in picture form is called flowchart. It is the one of the most
important technique to depict an algorithm.
Advantage of Flowchart:
1. Easier to understand
2. Helps to understand logic of problem
3. Easy to draw flowchart in any software like MS-Word
4. Complex problem can be represent using less symbols
5. It is the way to documenting any problem
6. Helps in debugging process
Disadvantage of Flowchart:
Symbol Name
Terminal
Use
Input / Output
Processing Used
Arrow
Connector
Decision
Solution:
Algorithm:
Step 1: Start
Step 4: IF x % 2 == 0 THEN
PRINT Even
ELSE
PRINT Odd
Step 5: End
Flowchart:
Coding, Compiling and Execution