Object Oriented Software Engineering   View all facts   Glossary   Help
subject > problem > defect > defect in an ordinary algorithm > use of an inappropriate standard algorithm
Next defect in an ordinary algorithmincorrect logical conditions    Updefect in an ordinary algorithm    Previous defect in an ordinary algorithmperforming a calculation in the wrong part of a control construct   

use of an inappropriate standard algorithm comparison table
Subject have testing strategy have example
use of a non-stable sortdeliberately run an experiment to see if the results are as expectedthe absence of code to handle an exception
use of a search or sort that is case sensitive when it should not betest algorithms with mixed-case data to see if the algorithm behaves as expectedthe absence of code to handle an exception
use of a search or sort that is not case sensitive when it should betest algorithms with mixed-case data to see if the algorithm behaves as expectedthe absence of code to handle an exception
use of an inefficient search algorithm
  • create a big enough list (e.g. 1 million elements) so that an unordered search should take some measurable time
  • sort the data, and measure how much time searching takes
  • double the number of sorted elements and measure the search time again
  • both searches should take negligible time; if they do take measurable time, then the time should be almost equal
the absence of code to handle an exception
use of an inefficient sort algorithm
  • increase the number of items being sorted and observe how execution time is effected
  • a good algorithm should take slightly more than double the first time - a bad algorithm will increase with the square of the number of items
using a 'bubble sort' instead of a more efficient approach to sorting

Next defect in an ordinary algorithmincorrect logical conditions    Updefect in an ordinary algorithm    Previous defect in an ordinary algorithmperforming a calculation in the wrong part of a control construct