Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following Deletemin ( ) function in binary heaps. The numbers at the left hand side specify each a node ( i . e

Consider the following Deletemin() function in binary heaps. The numbers at the left hand side specify each a node (i.e., a control node or a regular node) in the control flow graph.if isEmpty(h){display("queue empty"); return (h->elements[0]); }minelm =h->elements [1]; lastelm =h->elements[h->size--];for (i=1;i**2=h-> size; i= chld ){// find smaller childchild =i^(**)2;if (chld !=h->size &&h->elements[chld +1] h->elements[chld])chld++;// percolate one levelif ( lastelm > h-> elements[chld])h->elements[i]= h->elements[chld];else break; }h->elements [i]= lastelm;// restore min-heap property if violatedfor (j=i;hrarr >elements [j//2]> lastelm; j//=2)h rarr elements [j]=h-> elements [j//2];}h->elements [j]= lastelm; return minelm;a)(15 pts)Draw the control flow graph of the algorithm above! Your graph may contain only 14 nodes and the B and E nodes to denote the "begin" and "end" of the flow. Please use the numbers to mark the nodes (NOT the code!!!) in the flow graph!b)(5 pts)Calculate the computational complexity (CC) of the flow graph!c)(10 pts)List all independent paths!d)(10 pts)What independent paths are the following dependent paths composed of?B 1345678101112111314EB 134567894101112111314Ee)(5+5+5=15pts)What is the statement coverage for each of the following test cases?elements [1,dots,8]larr{11,21,16,31,41,61,71,51}elements larr empty;both of the two above cases together;f)(5+5+5=15pts)What is the edge coverage for the three cases above in part (e)?2 out of 5
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Students also viewed these Databases questions