Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

You implement the small label first algorithm. For a particular graph and a star

ID: 3592507 • Letter: Y

Question

You implement the small label first algorithm. For a particular graph and a starting vertex, your program should display this graph and show shortest distances to each vertex from the starting point.

( write program in C++ for the givien instruction using the execution table the program should display the graph.)

eRender.jpg Section 8.3 Shortest Paths 405 GURE 8.10 8.10 Anexecution of labelcorrectingalgorithm(), which apo which applies a deque. active vertex deque d g d h d 0o 1 1 0 01 9 o 00000 071 1

Explanation / Answer

#include <stdio.h>

#include <time.h>

// A function that terminates when enter key is pressed

void fun()

{

    printf("fun() starts ");

    printf("Press enter to stop fun ");

    while(1)

    {

        if (getchar())

            break;

    }

    printf("fun() ends ");

}

// The main program calls fun() and measures time taken by fun()

int main()

{

    // Calculate the time taken by fun()

    clock_t t;

    t = clock();

    fun();

    t = clock() - t;

    double time_taken = ((double)t)/CLOCKS_PER_SEC; // in seconds

    printf("fun() took %f seconds to execute ", time_taken);

    return 0;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote