Question 1 - Given the following list: 90 8 7 56 123 235 9 1 653 Can you guess the name of the sorting algorithm? 8 90 7 56 123 235 9 1 653 7 8 90 56 123 235 9 1 6537 8 56 90 123 235 9 1 6537 8 9 56 90 123 235 1 6531 7 8 9 56 90 123 235 653
Merge Sort
Insertion Sort
Selection Sort
Quick Sort
2)
What is the recursive part in recursive factorial function?
Question 2 - What is the recursive part in recursive factorial function?
if (n=0) return 1;
if (n==0) return 0;
if (n>0) return n*factorial(n-1);
if (n==0) return 1;
3)
Which one of the following is not true about Linked Structures?
Question 3 - Which one of the following is not true about Linked Structures?
Series of objects make up a linked list
Object reference variables hold the address of an object
Linked Structures uses a one big contiguous block of memory
Linked structure uses object references to create links between objects
4)
For the following minheap, which is implemented with arrays
[3][4][7]
What would be the content of the array after the insertion of the next element 2?
ps: Do not forget to swap the elements, and keep minheap properties
Question 4 - For the following minheap, which is implemented with arrays [3][4][7] What would be the content of the array after the insertion of the next element 2? ps: Do not forget to swap the elements, and keep minheap properties
[3][4][7][2]
[2][3][7][4]
[3][2][7][4]
[2][3][4][7]
5)
Asymptotic complexities of some of the algorithms are given below. Please select the fastest one.
Question 5 - Asymptotic complexities of some of the algorithms are given below. Please select the fastest one.
O(logN)
O(N)
6)
Consider the problem of computing the sum of all the integers between 1 and N, inclusive If N is 5, the sum is
Question 6 - Consider the problem of computing the sum of all the integers between 1 and N, inclusive If N is 5, the sum is
sum(1…N) = N + sum(1…(N-2))
sum(1…N) = N + sum(1…(N-1))
sum(1…N) = N + sum(1…(N))
sum(1…N) = N + sum(0…(N-1))
7)
Consider the following code and choose the right algorithm used in the following code.
public static <T extends Comparable<T>>
void sortMe(T[] data){
int position, scan;
T temp;
for (position = data.length - 1; position >= 0; position--)
{
for (scan = 0; scan <= position - 1; scan++)
{
if (data[scan].compareTo(data[scan+1]) > 0)
swap(data, scan, scan + 1);
}
}
}
Question 7 - Consider the following code and choose the right algorithm used in the following code. public static <T extends Comparable<T>> void sortMe(T[] data){ int position, scan; T temp; for (position = data.length - 1; position >= 0; position--) { for (scan = 0; scan <= position - 1; scan++) { if (data[scan].compareTo(data[scan+1]) > 0) swap(data, scan, scan + 1); } } }
Selection Sort
Insertion Sort
Quick Sort
Bubblee Sort
8)
If a binary search tree is not __________, it may be less efficient than a linear structure.
Question 8 - If a binary search tree is not __________, it may be less efficient than a linear structure.
complete
empty
balanced
None of the above
9)
Which one of the following is not true for abstraction?
Question 9 - Which one of the following is not true for abstraction?
Runs your code every time more efficient
Makes concept easier to manage
Encapsulates the object's data and the implementation of the operations
All objects are abstractions in that they provide well-defined operations
10)
A B-tree with the order of 4 is a ________ tree.
Question 10 - A B-tree with the order of 4 is a ________ tree.
heap
high-order
2-3
2-4
Process or set of rules that allow for the solving of specific, well-defined computational problems through a specific series of commands. This topic is fundamental in computer science, especially with regard to artificial intelligence, databases, graphics, networking, operating systems, and security.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.