lectures.alex.balgavy.eu

Lecture notes from university.
git clone git://git.alex.balgavy.eu/lectures.alex.balgavy.eu.git
Log | Files | Refs | Submodules

index.md (1070B)


      1 +++
      2 title = 'Algorithms'
      3 +++
      4 # Algorithms
      5 ## What is an algorithm?
      6 
      7 An effective method, finite n of steps or instructions, to solve a problem or accomplish a task
      8 
      9 always works
     10 
     11 ![screenshot.png](12aad5b5a9912ccca9e0190e5cc2f911.png)
     12 
     13 ## Solution strategies
     14 
     15 - Guess and check
     16     - “try something"
     17 - Try all possibilities
     18     - suitable with small possibilities
     19 - Divide the problem into steps
     20     - reduces complexity
     21     - simplifies the problem
     22 - Use formulas/equations
     23     - better overview
     24 - Discover a structure or pattern
     25     - sometimes it’s necessary to extend the problem
     26 - Make a model
     27     - simpler problem or situation
     28     - e.g. diagram or picture
     29 - Brute force
     30     - relies on computing power, uses computer
     31     - example: bubble sort, linear search
     32 - Divide and conquer
     33     - three steps:
     34 
     35         1. Divide problem of size *n* into number of subproblems of same type and about same size
     36 
     37         2. Conquer: recursively solve sub-problems
     38         3. Combine: appropriately combine solutions
     39 
     40     - examples: binary search, merge sort, quick sort