mid Flashcards
Which of the following are types of LinkedList?
d.
singly-linked, doubly-linked, multi-linked
An example of logarithmic time complexity is:
a.
Binary search
Consider the following recursive function fun(x, y).
What is the value of fun(4, 3)
int fun(int x, int y){
if (x == 0) return y; return fun(x - 1, x + y);
}
d.
13
Linear data structure that follows a particular order in which the operations are performed
c.
Queue
Look at square numbers: square(1) = 1; square(N) = square(N-1) + 2N -1
Which method below successfully implements this definition?
d.
int square( int N ){
if ( N==1 ) {
return 1;
}
else
{
return square(N-1) + 2*N - 1; }
}
Algorithm times are measured in terms of growth of an algorithm.
False
What does the notation O(n) represent in asymptotic analysis?
b.
The worst-case time complexity of an algorithm
Which of the following is not a typical application of stacks?
c.
Sorting algorithms
What is the time complexity of deleting an element from a singly linked list?
c.
O(n)
What is complexity independent of inputs?
a.
Complexity that doesn’t depend on the number of inputs
Which of the following usees FIFO method?
a.
Queue
For a binary search algorithm to work, it is necessary that the array list must be
a.
sorted
When the function with loops or recursive calls can have constant complexity?
b.
Number of iterations or calls independent of input size
What is the limitation of calling recursion?
limit of the heap memory
Specify ArrayList advantages over LinkedList
c.
arrayList is better for storing and accessing the data