Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Question 1. Consider the following algorithm:
ALGORITHM DFS(G)
//Input: Graph G = (V, E)
mark each vertex in V with 0 as a mark of being "unvisited"
count ← 0
for each vertex v in V do

    if v is marked with 0
         dfs (v)

 dfs (v)
count ← count + 1; mark v with count

for each vertex w in V adjacent to v do if w is marked with 0 dfs(w)

673_figure.jpg

(a) Implement the DFS algorithm to the graph in Figure 1 by starting at vertex A and resolving ties by the vertex alphabetical order and trace the values of the variables of the algorithm in the following table.

Count

 

 

 

 

 

 

 

 

 

 

Vertex

 

 

 

 

 

 

 

 

 

 

 

 

Stack

 

 

 

 

 

 

 

 

 

 

(b) Construct the corresponding DSF tree for the graph in Figure 1, and classify all the edges of the above DSF tree into four types: (1) tree edge, (2) back edge, (3) forward edge, and (4) cross edge.

(c) Write down the adjacency matrix for the graph in Figure 1.

Question 2. Consider the following algorithm:

ALGORITHM: BruteForceStringMatch (T [0..n-1], P [0..m-1])
// Input: An text array T [0..n - 1] of n characters and an pattern array P [0..m-1] of m characters
for i ← 0 to n-m do
     j ← 0
    while j < m and P[ j ] = T [ i + j ] do
            j ← j + 1
if j = m then return i
return -1

(a) Search the pattern (P = W X Y Z ) in the text (T = W X W X Y Z W X W X ) by the Brute Force String Match algorithm, and record the values of the parameters of this algorithm in the following table.

(b) How many Comparisons (both successful and unsuccessful) are made by the brute-force string-matching algorithm in search for the pattern 000100010001 in the binary text of four hundred zeros?

Question 3. Given 4 items of known weights w1, w2, w3, w4, and values v1, v2, v3, v4 as shown in Table 3-1and a knapsack of capacity W = 18 Kg, find the most valuable subset of the items that fit into the knapsack by exhaustive search.

Item

Weight (Kg)

Value

A

8

13

B

4

16

C

11

21

D

5

9

You must show your work to receive credit. A correct answer without showing your reasoning process will not receive credit.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92488289
  • Price:- $75

Guranteed 36 Hours Delivery, In Price:- $75

Have any Question?


Related Questions in Computer Engineering

Suppose that the demand curve for tickets to see a football

Suppose that the demand curve for tickets to see a football team play a game is given by Q = 80,000 - 40P and marginal cost is zero. The team's stadium can host 75,000 fans. i) How many tickets would the team sell if it ...

Representing problems as graphs i have 10 and i plan to

Representing Problems as Graphs I have $10, and I plan to spend some or all of my money on three types of candy, which I will buy one piece at a time: chocolate bars cost $3, almond rocca cost $2, and caramel chunks cost ...

Information systemsdirections answer the following if you

Information Systems Directions : Answer the following: If you were asked to develop a logical model of the registration system at a school, would it be better to use a top-down or bottom-up approach? Explain your reasoni ...

Questionsuppose we are comparing implementations of

Question Suppose we are comparing implementations of insertion sort and merge sort on the same machine. For inputs of size n, insertion sort runs in 8n2 steps, while merge sort runs in 64nlgn steps. For which values of n ...

Suppose that you need to create two-table database to

Suppose that you need to create two-table database to record information for a DVD rental kiosk. The following information needs to be recorded. For all movies: Movie number, title, category, rental rate, and whether or ...

Discussion question a sketch the storyboard for the simple

Discussion Question : a) Sketch the storyboard for the simple student information application. Recall that there are 6 files (scripts): connectcode.php, createtables.php, enterstudent.html, enterstudent.php, showstudents ...

System analysis project can you answer the 4 questions at

System Analysis project: can you answer the 4 questions at the task section. Personal Trainer, Inc. owns and operates fitness centers in a dozen Midwestern cities. The centers have done well, and the company is planning ...

Question suppose that in the definition of an euler cycle

Question : Suppose that in the definition of an Euler cycle, we drop the seemingly superfluous requirement that the Euler cycle visit every vertex and require only that the cycle include every edge. Show that now the the ...

Question lessons learned from the mirai botnet attack of

Question: Lessons learned from the Mirai Botnet attack of 2016 • Why was it so much more effective than previous BotNet designs? • What kind of mitigations would you recommend for protection? These two points must be ans ...

A suppose you purchase a 3-year zero-coupon bond with face

(a) Suppose you purchase a 3-year zero-coupon bond with face value of $1000 and a price of $850. What is the bond's yield? If you hold the bond to maturity, what will be your effective annual return? (b) Now suppose you ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As