Exam 1
What is the smallest integer k such that sqrt(n) is in O(n^k)
1
What is the smallest integer k such that nlog(n) is in O(n^k)
2
To the nearest integer, the log base 2 of 1,000,000 is:
20
With 32 bits, the largest value that we can express is roughly:
4,000,000,000
Which is true about the relationship between algorithms and problems?
A problem is a mapping from inputs to outputs, and there might be many algorithms that can accomplish this mapping.
Which is the best definition for algorithm?
A recipe
A tool for measuring the efficiency of an algorithm or problem is:
Algorithm analysis
A problem instance is a series of steps that act as a recipe to solve a particular problem.
False
A program maps inputs to outputs.
False
An algorithm can only work if it is written in the right type of programming language.
False
An algorithm maps inputs to outputs.
False
No algorithm for searching in an unsorted array can be worse than O(n) since any algorithm must look at every value in the array in the worst case.
False
Open hashing works well for disk-based hash systems.
False
The best case for the sequential search algorithm occurs when the array has only a single element.
False
The lower bound for a problem is defined as the cost of the best algorithm that we know.
False
The lower bound for the cost of sequential search is Ω(1) since this is the running time of the algorithm in the best case.
False
The lower bound in the worst case for the problem of searching an unsorted array is Ω(n) because this is the worst case cost of the sequential search algorithm.
False
The upper bound and lower bounds of the sequential search algorithm is in O(n) and Ω(n) respectively.
False
The upper bound for a problem is defined as the upper bound cost for the worst algorithm that we know.
False
The worst case for the sequencial search algorithm occurs when the array size tends to infinity.
False
The worst case lower bound for sorting an array is O(nlogn) since this is the cost of the best algorithm (in the worst case) that we know about.
False
There are some algorithms that do not terminate for certain inputs.
False
There is only one way that a given problem can be solved.
False
the sequential search algorithm is Θ(n²)
False
Which is NOT a topic that OpenDSA focuses on?
How to design and maintain large programs
If we know that algorithm X is Θ(n) in the average case, then what can we say about its TIGHTEST upper bound?
It is O(n) in the average case
the sequential search algorithm is O(?)
O(n²)
What is NOT one of the three standard steps to follow when selecting a data structure to solve a problem?
Run simulations to quantify the expected running time of the program
The binning hash function makes use of:
The high order digits or bits in the key
Which of these is more a concern for Software Engineering than for a data structures course?
To design an algorithm that is easy to understand, code, and debug
A problem instance is a specific selection of values for the problem input.
True
A problem maps inputs to outputs.
True
A program is an instance of an algorithm implemented in a specific programming language.
True
Big-Theta notation (Θ) defines an equivalence relation on the set of functions.
True
Closed hashing works well for disk-based hash systems.
True
Does the following relation define a partial ordering on the indicated set? isOlderThan on the set of people
True
Empty relation ∅ (i.e., the relation with no ordered pairs for which it is true) on the empty set is antisymmetric
True
For all algorithms that we have properly understand the running time analysis, the upper bound and lower bound will be always the same.
True
The lower bound for a problem is defined as the least cost that any algorithm could reach.
True
The upper bound for a problem is defined as the upper bound cost for the best algorithm that we know.
True
The worst case for sequential search occurs when the last element of the array is the value being searched for.
True
The worst case upper bound for sorting an array is O(nlogn) since this is the cost of the best algorithm (in the worst case) that we know about.
True
Which is the best definition for collision in a hash table?
Two records with different keys have the same hash value
As computers have become more powerful:
We have used that additional computing power to tackle more complex problems
A range query is:
Where a record is returned if its relevant key value falls between a pair of values
An exact-match query is:
Where a record is returned if its unique identifier matches the search value
What is a disadvantage of linear probing?
You tend to get primary clustering
A design pattern:
embodies and generalizes important design concepts for a recurring problem
relationship f(n) = 2^n g(n) = 3^n
f(n) is O(g(n))
relationship f(n) = 2^n g(n) = n^n
f(n) is O(g(n))
relationship f(n) = log(n²) g(n) = (log(n))²
f(n) is O(g(n))
relationship f(n) = 10 g(n) = log(10)
f(n) is Θ(g(n))
relationship f(n) = log(n²) g(n) = long(n) + 5
f(n) is Θ(g(n))
relationship f(n) = 2^n g(n) = 10n^2
f(n) is Ω(g(n))
relationship f(n) = √n g(n) = log(n²)
f(n) is Ω(g(n))
Disk drive access time is normally measured in:
milliseconds
The number of possible total orderings that can be defined on a set of n elements is:
n!
RAM access time is normally measured in:
nanoseconds
Which data structure would be used to implement recursion?
stack
For sequential search, the best case occurs when:
the search target is near the front of the array
Two main measures for the efficiency of an algorithm are
time and space
Given an array-based list implementation, deleting the current element takes how long in the average case?
Θ(n) time