Computer Networking: A Top-Down Approach (7th Edition)
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN: 9780133594140
Author: James Kurose, Keith Ross
Publisher: PEARSON
Bartleby Related Questions Icon

Related questions

Question

Implement in ARM7 assembly language a max-heap. In the main 
function, open a file to read a sequence of unsorted integers. For the first input integer, 
create a root node (12 bytes), holding the integer in the first 4 bytes and two empty 
pointers, one for the left child node and the other for the right child node. For each of the 
remaining input integers, build a node N to hold the number (X) and insert the node to the 
tree such that 
(1) any descending nodes of N contain integers smaller than X and ancestral nodes of 
N contain integers equal or larger than X. Therefore, if X is larger than the 
root.data, then node N will become the new root and the old root becomes N's 
left child. 
(2) when N is inserted below a node M (because N.data < M.data), follow the 
following order: 
a. if M has two empty children, N is inserted as the left child of M; 
b. if M has only one empty child, for example the right child is empty, then 
N becomes the right child; 
c. if M has no empty children, N is inserted as M's the left child and M's 
original left child becomes N's right child. 

Implement the insert function with the following specification: Insert (heap, node), 
where heap is a pointer to the root node, and node is the node to be inserted. The Insert 
function should return the pointer to the root.

 

Implement deleteMax function with the following specification: deleteMax(heap), where 
heap is a pointer to the root node of the heap. The deleteMax function should do the 
following: 
(1) return the maximum value stored in the heap, which is the root.data; 
(2) maintain the heap structure by recursively (i.e., continuously) percolating the 
vacancy down the binary tree to a leaf node and then removing the leaf node 
whose data is elevated to the parent node. Note: your deleteMax function does 
not have to be a recursive function.

data Null or a Pointer to the left child node Null or a Pointer to the right child node
Expert Solution
Check Mark
Knowledge Booster
Background pattern image
Similar questions
Recommended textbooks for you
Text book image
Computer Networking: A Top-Down Approach (7th Edi...
Computer Engineering
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:PEARSON
Text book image
Computer Organization and Design MIPS Edition, Fi...
Computer Engineering
ISBN:9780124077263
Author:David A. Patterson, John L. Hennessy
Publisher:Elsevier Science
Text book image
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:9781337569330
Author:Jill West, Tamara Dean, Jean Andrews
Publisher:Cengage Learning
Text book image
Concepts of Database Management
Computer Engineering
ISBN:9781337093422
Author:Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:Cengage Learning
Text book image
Prelude to Programming
Computer Engineering
ISBN:9780133750423
Author:VENIT, Stewart
Publisher:Pearson Education
Text book image
Sc Business Data Communications and Networking, T...
Computer Engineering
ISBN:9781119368830
Author:FITZGERALD
Publisher:WILEY