Wednesday, February 15, 2017

Algorithm reflection

>Give an explanation of each  statement below  and relate it to something they experienced as part of this lesson

  1. 4.2.4D Different correct algorithms for the same problem can have different efficiencies. Both linear search and binary search solve the same problem, but they have different efficiencies.

Some search algorithms are more efficient than others. The program I made should be much faster at searching large sets of data than linear search.

  1. 4.2.4E Sometimes more efficient algorithms are more complex. Binary search is more efficient than linear search, but even though it might be easy to understand at a high level, it is much more challenging to write code for.

More efficient algorithms can be more complex, and harder to code. My algorithm to find a number in a list was much more complex than the linear search.


  1. 4.2.4F Finding an efficient algorithm for a problem can help solve larger instances of the problem. The algorithms we wrote work for any size input.

Algorithms for smaller problems can be used to solve larger ones. In our search algorithm, we designed it to be used for 8 cards, but it could be used for a much larger set.


  1. 4.2.4G Efficiency includes both execution time and memory usage. Execution “time” here means number of operations that need to be performed in the worst case.

More efficient programs take less time and use less memory. My program should take less time and less memory than linear search.


  1. 4.2.4H Linear search can be used when searching for an item in any list; binary search can be used only when the list is sorted. Emphasis should be placed on the fact that binary search only works when the list is sorted. It’s a fact often forgotten.

Binary search can only be used in specific cases whereas linear can be used in almost any case. My algorithm only works with sorted lists because it relies on the fact they are ordered.

No comments:

Post a Comment