Menu

(Solved) : Particular Function Takes Positive Integer Parameter N Performs Exactly 3n 2n Log N 50log Q35814779 . . .

A particular function takes a positive integer parameter n andperforms exactly 3n+2n* log(n) + 50log(n)+1000 steps beforereturning. What is its run-time complexity?
O(log n)
      
O(n)
      
O(n^2)
      
O(n logn)
      
O(1)

for the array {7, 4, 9, 2, 6, 3}, using the following sortingalgorithm to run it. Write the value in the array for eachpass.

a.Bubble sort algorithm (5 pts)
b.Selection sort algorithm (5 pts)

For the infix expression 2+(3+5-2*4), show step by step tochange it into a postfix expression using a stack, you need to showthe contents of the stack and the output expression. (suppose theleft side is the bottom of the stack, and the left side is thefront of the queue or array).

The value of prefix expression * + 6 4 – 3 2 is
      
10
      
4
      
8
      
21
      
6

Suppose you push 20, 40, 30, 50, and 10 into the priority queue.Then you remove three items. Which on is the front on thequeue?
  
40
      
20
      
30
      
50
      
10

A queue is a data structure where elements are
inserted at the front and removed from the back
      
inserted and removed from the top
      
inserted at the back and removed from the front
      
inserted and removed from both ends
      
none of the above

Inserting an item into an ordered array

takes time proportional to the size of the array
      
requires multiple comparisons and shifts
      
requires shifting other items to make room
      
takes the same time no matter how many items there are
      
a, b, c

If f(n)= log2(n) and g(n)= log10(n), we could use the asymptoticnotation f(n) =X(g(n)), then the X could be ______?
Big O
      
Big Omega
      
Big Theta
      
All of the above
      
none of the above

An algorithm takes 10 seconds for an input size of 10. If thealgorithm is cubic, approximately how long does it take to solve aproblem of size 40?
640 seconds
      
10 seconds
      
400 seconds
      
40 seconds
      
160 seconds

What does the function f() below do?

boolean f(int a[])

{

for (int i =0; i<a.length; i++) {

    if (a[i+1] < a[i])

    return false;

}

return true;

}

it returns whether the last element of the array is the max ofall the elements

it returns whether the last element of the array is the min ofall the elements

it returns whether the array is sorted in ascending order

it returns whether the array is sorted in descending order

none of the above

Expert Answer


Answer to Particular Function Takes Positive Integer Parameter N Performs Exactly 3n 2n Log N 50log Q35814779 . . .

OR