GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

Author Archives: Anonymous

According to the lecture slides, what is the time complexity…

According to the lecture slides, what is the time complexity of removeMin for the Sorted List implementation (assuming efficient removal from the front)?

Read Details

What is the time complexity of this insert method in a Heap…

What is the time complexity of this insert method in a Heap Priority Queue? public void insert(E key) { heap.add(key); // Step 1 upheap(heap.size() – 1); // Step 2 }

Read Details

What is the value of `parent` in the following code if j = 5…

What is the value of `parent` in the following code if j = 5? int parent = (j – 1) / 2;

Read Details

Which of the following best defines the Heap-Order Property…

Which of the following best defines the Heap-Order Property for a Min-Heap?

Read Details

public V put(K key, V value) { for (Entry e : list) { if (e….

public V put(K key, V value) { for (Entry e : list) { if (e.getKey().equals(key)) { V old = e.getValue(); e.setValue(value); return old; } } list.add(new Entry(key, value)); return null; } What is the worst-case time complexity of the put operation shown above for a map with n entries?

Read Details

Why is sorting data a critical prerequisite for algorithms l…

Why is sorting data a critical prerequisite for algorithms like Binary Search?

Read Details

Which of the following sorting algorithms have an average-ca…

Which of the following sorting algorithms have an average-case time complexity of O(n log n)? (Select all that apply)

Read Details

What does the following upheap condition check for? while (…

What does the following upheap condition check for? while (j > 0) { int parent = (j – 1) / 2; if (heap.get(j).compareTo(heap.get(parent)) >= 0) break; // swap logic… }

Read Details

You are given the array: [ 5, 1, 4, 2, 8 ]. After two passes…

You are given the array: [ 5, 1, 4, 2, 8 ]. After two passes of the outer loop (i=1 and i=2) of an Insertion Sort, what will be the state of the array?

Read Details

Which sorting algorithm is conceptually described as “mimics…

Which sorting algorithm is conceptually described as “mimics how humans sort a hand of playing cards”?

Read Details

Posts pagination

Newer posts 1 … 979 980 981 982 983 … 83,318 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top