Skip to content

This repo contains all common algorithms like searching , sorting , divide and conquer , greedy etc. and their implementation in C language with code to find their time complexity

Notifications You must be signed in to change notification settings

Saurabhdimri06/Algorithms-implementation-using-C

Repository files navigation

Algorithms

Algorithms are very important in computer Science. The best chosen algorithm makes sure computer will do the given task at best possible manner. In cases where efficiency matter a proper algorithm is really vital to be used. An algorithm is important in optimizing a computer program according to the available resources. .

Ultimately when anyone decide to solve a problem through better algorithms then searching for the best combination of program speed and least amount of memory consumption is desired.

Types Of Algorithms :

- Brute force

Brute force algorithm emphasis on solving problems in the most straight forward manner. It implies to use basic techniques to solve problems. In short these are simplest algorithms to be used. The simplicity costs in speed as this algorithm is comparatively slow in generating results. The best way is to use it with problems those are having small input size.

- Divide and conquer

The basic idea of this method is to make programs based on dividing the size of problems. In each loop cut the problem in parts with constant factor and then process further in the same fashion. This is a fast algorithm.

- Dynamic programming

If you are searching of one efficient fast algorithm then dynamic programming is here. In this algorithm all focus is made on speed of execution even it costs memory space. Simply saying in this method space for time is sacrificed. The execution speed drastically reduces in this algorithm. This method is particularly useful to solve problems that those have overlapping sub problems.

- Greedy algorithm

Greedy algorithm is a step based algorithm. In a greedy algorithm we analyze the problem in each step. Then use the best locally possible optimum solution to this particular step .Then the process repeats to all steps. It will lead to a globally optimal solution.

Algorithms Covererd:

  • Bubble and Selection Sort Bubble and Selection both are sorting techniques. As we know in our daily lives how much important it is to have an efficent sorting technique to handel large amount of data so it becomes necessary to have a efficent sorting technique at hand.

Time Complexity of Bubble Sort - O(n) and that of Selection Sort is - O(n2)

  • Matrix Multiplication Strassen in 1969 which gives an overview that how we can find the multiplication of two 2*2 dimension matrix by the brute-force algorithm. But by using divide and conquer technique the overall complexity for multiplication two matrices is reduced. This happens by decreasing the total number if multiplication performed at the expenses of a slight increase in the number of addition.

The general algorithm's time complexity is O(n^3), while the Strassen's algorithm is O(n^2.80).

Releases

No releases published

Packages

No packages published

Languages