Please answer all questions or points will not be given, thanks! Question 2 (1 p
ID: 3740133 • Letter: P
Question
Please answer all questions or points will not be given, thanks!
Question 2 (1 point)
The ______ algorithm works like a selection sort but accomplishes this task efficiently by using a data structure that is a special type of binary tree
Question 2 options:
Question 3 (1 point)
Heap sort is a comparison based sorting algorithm
Question 3 options:
Question 4 (1 point)
______ dorting algorithms maintain the relative order of records with equal keys.
Question 4 options:
Question 5 (1 point)
Which of these algorithms has the fewest number of swap operations (in terms of n)?
Question 5 options:
1)
2)
3)
4)
5)
Question 6 (1 point)
The minimum possible time complexity for a comparison based sorting algorithm and a random input array is O(n)
Question 6 options:
Question 7 (1 point)
A ______ sort examines the data only by comparing the two elements with a comparison operator.
Question 7 options:
Question 8 (1 point)
A Stack is used when data is transferred asynchronously between two processes.
Question 8 options:
Question 9 (1 point)
What is the output of the following function with the input "( ( ) ) ( )"
function g(s) {
var a = s.split("");
var b = [];
for (var i = 0; i < a.length; i++) {
if (a[i] == '(') {b.push('*');}
if (a[i] == ')') {if (b.length > 0) b.pop();}
}
return b.length;
}
Question 9 options:
Question 10 (1 point)
Given the following 2 functions - what is the value of calling fb(5,2)?
function fa(x, y){
if (y == 0) return 0;
return (x + fa(x, y-1));
}
function fb(x, y) {
if (y == 0) return 1;
return fa(x, fb(x, y-1));
}
Question 10 options:
Explanation / Answer
As per Chegg policy, I am answering only first 4 question. Kindly upload remaining questions further in order to get them answered.
Q2.) Heap sort
Q3.) True. heap sort is a comparison based algorithm
Q4.) Stable sorting algortihms; e.g., bubble sort, merge sort
Q5.) option b, selection sort