Docsity

Problem Solving Approaches: A Comprehensive Guide with Examples, Study notes of Computer Science

Partial preview of the text

Download Problem Solving Approaches: A Comprehensive Guide with Examples and more Study notes Computer Science in PDF only on Docsity!

Various Problem Solving

Approaches

Answer this

• Goitre is related to iodine as Anaemia is

related to

(a) Vitamin (b) Blood (c) Iron

(d) Weakness

• Iron – related by deficiency

• Analogy

Answer this

• Doctor is related to stethoscope as painter is

related to _______

(a) Art (b) Blood (c) Brush

(d) Water

• Brush – related by tool used

• Analogy

Problem solving by analogy

  • (^) Very often problems can be solved by looking at similar problems. For example, consider the problem of adding two 1x3 matrices A and B. The matrices are made up of 1 row and 3 columns.
  • (^) Let A = [ a 11 a 12 a 13 ] B =[ b 11 b 12 b 13 ].
  • (^) Then A + B is
  • A + B = [a 11 +b 11 a 12 +b 12 a 13 +b 13 ]

Problem solving by brainstorming

  • (^) Consider a scenario in a company, when it has got an additional project
  • (^) To manage the extra work, a discussion is made between 3 employees of the company and they give different suggestions.
  • (^) First participant suggests outsourcing the work
  • (^) Second participant suggests to hire a new employee.
  • (^) Third one suggest to share extra workload among employees
  • (^) Weight age for each idea is given on the basis of cost, feasibility and ease of implementation, and how it will help other processes.

Problem solving by brainstorming

Generated idea Low cost Easy to implement and is feasible Will help other processes Total Outsource to a vendor 20 20 20 60 Hire a new employee 30 10 10 50 Share the extra workload 10 30 30 70

Question

  • (^) From which city either Texas or Las vegas one can quickly reach pacific ocean?

Abstraction

Problem solving by abstraction

  • (^) Every object or event in the world can be thought of in many ways.
  • (^) Take the four-legged beast you see walking down the street on a leash, it could be thought of as:
  • (^) Fluffy the poodle who lives next door (very specific)
  • (^) a French poodle (slightly less specific)
  • (^) a dog (a bit more abstract)
  • (^) an animal (more abstract)
  • (^) a thing (very abstract)

Problem solving by abstraction

  • (^) Suppose we have a quadratic equation a*x^
    • b*x + c = 0.
  • (^) Then a well-known result says that the roots of that quadratic equation are
  • (^) X1 = ( -b + squareroot(b^2 -4ac) ) / (2*a)
  • (^) X2 = ( -b - squareroot(b^2 -4ac) ) / (2*a)

Problem solving by abstraction

  • (^) A computer program for the quadratic equation helps to easily obtain a computer program for a quartic equation.
  • (^) Abstraction helps to simplify the original problem into problems which are simpler and for which we know the solution.

Problem solving by divide and conquer

  • (^) The technique we just described is called as binary search. Every iteration in binary search eliminates half of the remaining possibilities. This makes binary searches very efficient - even for large collections. Binary search is an example of divide and conquer.

Problem solving by divide and conquer

  • (^) The Euclidean algorithm of finding the gcd of two integers is another example of the divide and conquer strategy.A divide and conquer problem solving strategy works by recursively breaking down a problem into two or more sub-problems of the same (or related) type, until these become simple enough to be solved directly. The solutions to the sub- problems are then combined to give a solution to the original problem.