100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached 4.6 TrustPilot
logo-home
Exam (elaborations)

COSC 2436 Final Exam UPDATED ACTUAL Exam Questions and CORRECT Answers

Rating
-
Sold
-
Pages
21
Grade
A+
Uploaded on
15-12-2024
Written in
2024/2025

COSC 2436 Final Exam UPDATED ACTUAL Exam Questions and CORRECT Answers True and False statement: Algorithm upheap restores the heap-order property by swapping k along an upward path from the insertion node. - CORRECT ANSWER - tru

Show more Read less
Institution
Cosc
Course
Cosc










Whoops! We can’t load your doc right now. Try again or contact support.

Written for

Institution
Cosc
Course
Cosc

Document information

Uploaded on
December 15, 2024
Number of pages
21
Written in
2024/2025
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

Content preview

COSC 2436 Final Exam UPDATED
ACTUAL Exam Questions and CORRECT
Answers
True and False statement:


Algorithm upheap restores the heap-order property by swapping k along an upward path from the
insertion node. - CORRECT ANSWER - true


True and False statement:


The following is a heap property:


For a max heap, the value of each node is greater than or equal to the values of it's children, and
for a min heap, the value of each node is less than or equal to the values of it's children. -
CORRECT ANSWER - true


what is a heap?


A heap is a hash tree data structure that can be used to implement a priority queue efficiently.
A heap is a array list in a tree data structure that can be used to implement a priority queue
efficiently.
A heap is an unbalanced tree data structure that can be used to implement a priority queue
efficiently.
A heap is a binary tree data structure that can be used to implement a priority queue efficiently. -
CORRECT ANSWER - A heap is a binary tree data structure that can be used to
implement a priority queue efficiently.


In the following code:

,public static void main(String[] args) {


MergeKSortedLists merger = new MergeKSortedLists();


ListNode[] lists = new ListNode[3];


lists[0] = new ListNode(1);


lists[0].next = new ListNode(4);


lists[0].next.next = new ListNode(5);


lists[1] = new ListNode(1);


lists[1].next = new ListNode(3);


lists[1].next.next = new ListNode(4);


lists[2] = new ListNode(2);


lists[2].next = new ListNode(6);


ListNode mergedList = merger.mergeKLists(lists);


System.out.print("Merged List: ");


merger.printList(mergedList);

, }


}


What does the line [ ListNode mergedList = merger.mergeKLists(lists); ] do? - CORRECT
ANSWER - Merged the sorted lists


In the following code:


while (!minHeap.isEmpty()) {


ListNode node = minHeap.poll();


current.next = node;


current = current.next;


if (node.next != null) {


minHeap.offer(node.next);


}
}

What does the line [ ListNode node = minHeap.poll(); ] do? - CORRECT ANSWER -
Extract the node with the smallest value from the min heap


Priority queue can be implemented using the following data structures: (choose all that applies)


Arrays

Get to know the seller

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
MGRADES Stanford University
View profile
Follow You need to be logged in order to follow users or courses
Sold
1123
Member since
2 year
Number of followers
104
Documents
68962
Last sold
7 hours ago
MGRADES (Stanford Top Brains)

Welcome to MGRADES Exams, practices and Study materials Just think of me as the plug you will refer to your friends Me and my team will always make sure you get the best value from the exams markets. I offer the best study and exam materials for a wide range of courses and units. Make your study sessions more efficient and effective. Dive in and discover all you need to excel in your academic journey!

3.8

178 reviews

5
76
4
31
3
47
2
9
1
15

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Frequently asked questions