fundamentals of algorithms Flashcards
define an algorithm
a sequence of precise instructions that, once performed, will complete a specific task
what are algorithms used in
solving problems in computing, but they’re also frequently used to describe sequences of instructions in the non-digital world
what are computer programs
algorithms written in a programming language
define decomposition
the process of breaking down a complex task into a sequence of simpler subtasks or subproblems
how does decomposition make a problem easier to solve
because each of the subproblems can be looked at and solved separately; sometimes referred to as ‘divide and conquer’
advantages of decomposition
- error detection and debugging is made easier when you focus on smaller sections of code
- makes solving larger problems easier to solve
- some modules may be reusable in other
define abstraction
the act of removing complexity from a problem by hiding background details and removing unnecessary information
advantages of abstraction
- it allows the developer to focus on the important parts of the problem to develop a solution
- large problems are made simpler and easier to r
what can a linear search be used on
both ordered and unordered lists
linear search method
the items in the list are examined in order (one by one) until it either finds the search item or reaches the end of the list
name the two searching algorithms
linear and binary searches
when is it suitable to use a linear search and why
it is more suitable for small lists of data, because the linear search is an inefficient algorithm
what determines an efficient searching algorithm
if in the worst-case scenario, it needs many comparisons in order to search a large list