Data Structures and Algorithms Flashcards
What is an algorithm?
An algorithm is a set of finite steps, aimed at providing a solution to a problem
What are the charateristics/properties of an algorithm?
- Input/Output: Algorithms can take in 0 or more inputs, but must always produce some sort of output
- Finiteness: Algorithms must have a finite number of steps
- Definiteness: Every step of an algorithm must be clearly stated and unambigous
- Effectiveness: Every step of an algorithm must be able to be converted into a programming language
- Generality: An algorithm must be able to accept all inputs in it’s valid set of inputs, to produce the desired output
What are the categories of algorithms?
Algorithms are categorised based on how their instructions are executed.
1. Sequencial algorithms: Here every instruction is executed, and they are executed in a succesive manner
2. Selective algorithms: Here every the execution or omision of certian instructions depends on if a certain condition is fuffilled or not
3. Iterative algorithms: These are algorithms where intructions or sets of instructions are repeated a number of times
How is the performance analysis of an algorithm done?
The efficeincy of algorithms is determined by how much time or space(memory) they require to complete execution, algorithms are said to be efficent if they
require the least amount of space(memory) or time to complete execution. The two ways of determining an algorithm’s efficiency are:
- Space complexity: This is the amount of space(memory) required by an algorithm to complete execution
- Time complexity: This is the amout of time required by an algorithm to complete execution
What is asymtotic analysis and what are asymtotic notations?
Asymtotic analysis is a mathematical way of figuring out the effiency of algorithm, it is solely dependent on the input of the algorithm and it is done with the help
of asymtotic notations, whtich are mathematical notations used to reppresent the effiency of algorithms
What are the types of efficiency/scenariors of algorithms?
- Worst case: The maximum time or memory(space) required by an algorithm to complete execution
- Average case: The typical or average time or space required by an algorithm to complete execution
- Best case: The minimum time or memery(space) required by an algorithm to complete execution
What are some asymtotic noations used?
Asymtotic notations are used to represent the different scenerios of algorithms, big Oh (O) for worst case, Omega() for best case, and Teta() for best and worst case
What are the Issues that come about when designing an algorithm?
How to design and how to analyze the algorithm
what are the types of brute force algorithms?
Sacrificing and Optimizing Algorithms
What are the different design approaches to algorithms?
Design an algorithm can be approached in 1 of 5 ways that include:
1. Brute force algorithms: These are algorithms where every potential solution to a problem is tried until the solution is found
- Divide and Conquer: These are algorithms where a problem is divided into smaller problems, each is solved and their solutions are combined to solve the initial problem
- Greedy Algorithms: These are algorithms where the optimal decision is made at every step of the algorithm with the aim of producing the optimal solution
- Branch and bound algorithms: These are algorithms where every possible solution to a problem is analyzed to find the most efficient solution
- Randomized algorithms: These are algorithms where random bits are added to the input to produce randomized outputs
Which algorithm is used only in integer programming?
Branch and Bound algorithms
Differentiate between Priori and Posterior Analysis.
Priori Analysis is the analysis of an algorithm before it is implemented. Posterior analysis is the analysis of an algorithm after its implementation
What is the performance analysis of an algorithm?
It is analyzing an algorithm and predicting how much space(memory) or time it will require to complete execution based on its input
What are the types of algorithms that exist?
insertion, deletion, updation, search and sorting algorithms
What is a data structure?
A data structure is a set of data elements that provide an efficient way to store, organize, and use data in the computer.