Definitions Flashcards
What is an algorithm?
A sequence of unambiguous instructions for solving a problem (obtaining a required output
for any legitimate input in a finite amount of time)
What is a Set?
A collection of elements.
Usually containing no repetitions, and in no particular order
What is the result of a union (∪) of these two sets?
T1 = {1,3,4,6}
T2 = {1,2,6,7}
T1 ∪ T2 = {1,2,3,4,6,7}
“The set of elements present in either set”
What is the result of an Intersection (∩) of these two sets?
T1 = {1,3,4,6}
T2 = {1,2,6,7}
T1 ∩ T2 = {1,6}
“The set of elements appearing in both sets”
How do you represent an empty set?
∅ = A set with no elements
What is a subset(⊂)?
A set where every element in the subset is present in the superset.
R1 = {1,3} is a subset of R2 = {1,2,3,4,5}
What are Undecidable Problems?
A problem for which there exists no algorithm capable of solving all instances of the problem in a finite amount of time
What is an NP problem?
A problem that can be solved in polynomial type using a non-deterministic algorithm
What is a P problem?
A problem that can be solved in polynomial time (e.g n or n2)
What is a Non-deterministic Algorithm?
An algorithm that will make guesses as it proceeds.
It will then check it’s answer later to see if the guess was right?
What is pseudocode?
A mixture of natural and programming languages
Used to describe an algorithm
What do these mean in pseudocode?
1. x ← 0
2. if n > 0 then
3. for k ← 1 to n do
4. // Input or Output
- Value assignment
- If statement
- Iteration
- Comment