1 / 4

About how to implement algorithms

About how to implement algorithms. Fall 2013, Haidong Xue. One P roblem, M ultiple A lgorithms. Given a problem Problem Input: IN Algorithms: Alg1(IN), Alg2( IN ), … , AlgN ( IN ) E.g.: your term project sorting. A good way to implement them: the Strategy Pattern.

zocha
Télécharger la présentation

About how to implement algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. About how to implement algorithms Fall 2013, HaidongXue

  2. One Problem, Multiple Algorithms • Given a problem • Problem Input: IN • Algorithms: • Alg1(IN), Alg2(IN), … , AlgN(IN) • E.g.: • your term project • sorting

  3. A good way to implement them: the Strategy Pattern AbstractAlgorithm solve() ConcreteAlgorithm2 solve() ConcreteAlgorithmN solve() ConcreteAlgorithm1 solve() …

  4. Example: sorting uses Tester AbstractSortingAlgorithm sort() InsertionSort sort() XSort sort() Quicksort() sort() … Let’s do it!

More Related