# Algorithm in C ( With Examples) - Arsh Ramgarhia

What is an  Algorithm in C

The Algorithm in C language: It is a part of the plan for the computer program. An algorithm is an effective procedure for solving the problem in the first number of steps. Start = algorithm + data. It is a step by step process to solving problems.
Every programming design process has 2 phases.

An algorithm is a very essential and necessary part of programming where programmers solve any queries. It is considerable logic in programming. Step by step process is known as an algorithm in programming.

1. Problem-solving phase - It creates an algorithm that solves the problem.

2. Implementation phase- It translates an algorithm into the programming language.

What are Pseudo codes?

when an algorithm can be written in English(sentences), then it is called pseudo-codes.

Characteristics of the algorithm:

1. Input:- There are zero or more value is externally supplied as input.
2. Output:- At least one value is produced as an output.

3. Definiteness:- its single step must be clear and unambiguous. Unambiguous means that some steps must be repeated unnecessarily.

4. Finiteness:- If we trace the steps of an algorithm, then for all cases, the algorithm must terminate after a finite number of levels.

5'. Effectiveness:- Each step must be sufficiently essential that it can, in principle, be carried out by a person using only paper and pencil. Each step must be not only definite but also be feasible.

6. Algorithm:- After adequately defining the problem, as detailed, finite, step by step procedure for solving it must be developed by the programmer called an algorithm.

How Algorithm In C Works:

### Bankers algorithm in C

It is also known as Dijkstra's algorithm in c language. The banker algorithm is an avoidance algorithm and also known as a deadlock detection algorithm. It is generally used in the banking system to make the best security. This algorithm is made for the best protection of the banking system by check the safe state where any recourses requested. If any customer requests to cash draw, then the Bankers Algorithm works with an analogy of bank. Where the bank store data to banker algorithm. Edsger Dijkstra invented it.

Merge sort algorithm in C

Merge sort algorithm work on the principle of the divide. Merge sort is work like sort each half by recursively using this same process. It is generally used in sorting split the input in half.

kruskal's algorithm in c

Kruskal's algorithm is a spanning tree algorithm that takes a graph as the input, and then after that, it finds the subsets of edges in the chart. It works to find the local optimum in the hopes of finding a global optimum for better results.

### NAMES OF ALGORITHMS IN C

• lru page replacement algorithm in c

• prim's algorithm in c

• prims algorithm

• dda line drawing algorithm in c

• optimal page replacement algorithm in c

• FIFO page replacement algorithm in c

• bresenham line drawing algorithm in c

• bubble sort algorithm in c

• merge sort algorithm in c

• Merge sort algorithm in c

• Kruskal's algorithm in c