Skip to content

Demonastrate various important algorithms for learning programming better.

Notifications You must be signed in to change notification settings

habibsql/TheAlgorithms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TheAlgorithms

Demonastrate various important algorithms for learning better programming.

What is Algorithm

A step by step procedure to solve logical problems. Each step has clear instructions.

what

A recipe is a good example of an algorithm because it says what must be done, step by step. It takes inputs (ingredients) and produce an output (complete dish). Informally, an algorithm can be called "a list of steps".

Whatis1

Algorithm Types

Various types of algorithm exists. Sometime it called algorithm design techniques. Most funndamental types of algorithms are:

  • Bruthforce: Try all possibilities.
  • Divide and Conquer: Break large problem into distinct sub problems.
  • Transformation: Convert problem into another one.
  • Dynamic Programming: Break problem into overlapping sub problems.
  • Greedy: Reapeatly do until find the best one.
  • Iterative Improvement: Reapeatedly improve current solution.
  • Randomization: Use random numbers,

types1

We can check few examples so that understand how types are used in few predefined algorithms:

type2

Algorithm Properties

Algorithm must have 5 properties:

  • Input Specified: Input is from a specified set, I.
  • Output Specified: Output is from a specified set, O
  • Effectiveness: Its steps are defined precisely and can be done.
  • Finiteness: Finitely many steps are executed, each taking finite time.
  • Correct: The output is correct.

properties

Algorithm Efficency

  • A measure of the amount of resources consumed in solving a problem of size n

    • Time
    • Space
  • Code the algorithm, run it with some specific input and measure time taken

  • Big Oh(asymptotic analysis) provies a formula that associate n the problem size, with t, the processing time required to solve the problem.

Best Algorithm choice

For a particualr problem there can be many solutions. It is important to analysis the given context, constraint etc. then analysis the complexity then choose the algorithm.

Compexity-1

Compexity-1

Releases

No releases published

Packages

No packages published

Languages