Computer Science: An Overview (13th Edition) (What's New in Computer Science)
13th Edition
ISBN: 9780134875460
Author: Glenn Brookshear, Dennis Brylow
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 11, Problem 36CRP
Program Plan Intro
Best fit
To eliminate irrelevant moves, the tiles that are out of place should always be adjacent to the hole. The tiles that are already in place should not be moved. The best fit algorithm eliminates the moves having a higher cost but only for proceeding moves. This algorithm does not consider the overall cost associated with a path.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
link(a,b).
link(a,c).
link(b,c).
link(b,d).
link(c,d).
link(d,e).
link(d,f).
link(e,f).
link(f,g).
Using The above Formulate the appropriate Prolog predicate
"path(X,Y,N)" which is true if (and only if) there is a path of length
"N" from node "X" to node "Y". For example, there is a path of length
2 from "a" to "d": "a->b->d", but also "a->c->d", and so "path(a,d,2)"
gives "true" (two times). There is also a path of length 3 from "a"
to "d": "a->b->c->d". Test this predicate out on the above network to
verify whether or not it is working correctly.
Once this is working correctly, note now, that e.g., "path(a,e,N)."
will give multiple answers:
i)- Write an algorithm to find the longest path in a DAG, where the length of the path is measured by the number of edges that it contains. What is the asymptotic complexity of your algorithm?
ii) - Write an algorithm to find a maximum cost spanning tree, that is, the spanning tree with highest possible cost.
link(a,b).
link(a,c).
link(b,c).
link(b,d).
link(c,d).
link(d,e).
link(d,f).
link(e,f).
link(f,g).
Using the above Formulate the appropriate Prolog predicate
"path(X,Y,N)" which is true if (and only if) there is a path of length
"N" from node "X" to node "Y". For example, there is a path of length
Chapter 11 Solutions
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
Ch. 11.1 - Prob. 1QECh. 11.1 - Prob. 2QECh. 11.1 - Prob. 3QECh. 11.1 - Prob. 4QECh. 11.1 - Prob. 5QECh. 11.2 - Prob. 1QECh. 11.2 - Prob. 2QECh. 11.2 - Prob. 3QECh. 11.2 - Prob. 4QECh. 11.2 - Identify the ambiguities involved in translating...
Ch. 11.2 - Prob. 6QECh. 11.2 - Prob. 7QECh. 11.3 - Prob. 1QECh. 11.3 - Prob. 2QECh. 11.3 - Prob. 3QECh. 11.3 - Prob. 4QECh. 11.3 - Prob. 5QECh. 11.3 - Prob. 6QECh. 11.3 - Prob. 7QECh. 11.3 - Prob. 8QECh. 11.3 - Prob. 9QECh. 11.4 - Prob. 1QECh. 11.4 - Prob. 2QECh. 11.4 - Prob. 3QECh. 11.4 - Prob. 4QECh. 11.4 - Prob. 5QECh. 11.5 - Prob. 1QECh. 11.5 - Prob. 2QECh. 11.5 - Prob. 3QECh. 11.6 - Prob. 1QECh. 11.6 - Prob. 2QECh. 11.6 - Prob. 3QECh. 11.7 - Prob. 1QECh. 11.7 - Prob. 2QECh. 11.7 - Prob. 3QECh. 11 - Prob. 1CRPCh. 11 - Prob. 2CRPCh. 11 - Identify each of the following responses as being...Ch. 11 - Prob. 4CRPCh. 11 - Prob. 5CRPCh. 11 - Prob. 6CRPCh. 11 - Which of the following activities do you expect to...Ch. 11 - Prob. 8CRPCh. 11 - Prob. 9CRPCh. 11 - Prob. 10CRPCh. 11 - Prob. 11CRPCh. 11 - Prob. 12CRPCh. 11 - Prob. 13CRPCh. 11 - Prob. 14CRPCh. 11 - Prob. 15CRPCh. 11 - Prob. 16CRPCh. 11 - Prob. 17CRPCh. 11 - Prob. 18CRPCh. 11 - Give an example in which the closed-world...Ch. 11 - Prob. 20CRPCh. 11 - Prob. 21CRPCh. 11 - Prob. 22CRPCh. 11 - Prob. 23CRPCh. 11 - Prob. 24CRPCh. 11 - Prob. 25CRPCh. 11 - Prob. 26CRPCh. 11 - Prob. 27CRPCh. 11 - Prob. 28CRPCh. 11 - Prob. 29CRPCh. 11 - Prob. 30CRPCh. 11 - Prob. 31CRPCh. 11 - Prob. 32CRPCh. 11 - Prob. 33CRPCh. 11 - What heuristic do you use when searching for a...Ch. 11 - Prob. 35CRPCh. 11 - Prob. 36CRPCh. 11 - Prob. 37CRPCh. 11 - Prob. 38CRPCh. 11 - Suppose your job is to supervise the loading of...Ch. 11 - Prob. 40CRPCh. 11 - Prob. 41CRPCh. 11 - Prob. 42CRPCh. 11 - Prob. 43CRPCh. 11 - Prob. 44CRPCh. 11 - Prob. 45CRPCh. 11 - Draw a diagram similar to Figure 11.5 representing...Ch. 11 - Prob. 47CRPCh. 11 - Prob. 48CRPCh. 11 - Prob. 49CRPCh. 11 - Prob. 50CRPCh. 11 - Prob. 51CRPCh. 11 - Prob. 52CRPCh. 11 - Prob. 53CRPCh. 11 - Prob. 54CRPCh. 11 - Prob. 1SICh. 11 - Prob. 2SICh. 11 - Prob. 3SICh. 11 - Prob. 4SICh. 11 - Prob. 5SICh. 11 - Prob. 6SICh. 11 - Prob. 7SICh. 11 - Prob. 8SICh. 11 - Prob. 9SICh. 11 - Prob. 10SICh. 11 - Prob. 11SICh. 11 - Prob. 12SICh. 11 - A GPS in an automobile provides a friendly voice...Ch. 11 - Prob. 14SI
Knowledge Booster
Similar questions
- Given the following search tree, state the order in which the nodes will be searched for breadth first and depth first, until a solution B is reached.arrow_forwardLet G be an undirected graph whose vertices are the integers 1 through 8, and let the adjacent vertices of each vertex be given by the table below: look at the picture sent Assume that, in a traversal of G, the adjacent vertices of a given vertex are returned in the same order as they are listed in the table above. Which statement of the following is correct? group of answer choices a) The sequence of vertices visited using a DFS traversal starting at vertex 1: 1, 2, 3, 4, 6, 5, 7, 8. b) The sequence of vertices visited using a BFS traversal starting at vertex 1: 1, 2, 3, 4, 6, 5, 7, 8. c) Both sequences are wrong. d) Both sequences are correct.arrow_forwardNote: Your solution should have O(n) time complexity, where n is the number of elements in l, and O(1) additional space complexity, since this is what you would be asked to accomplish in an interview. Given a linked list l, reverse its nodes k at a time and return the modified list. k is a positive integer that is less than or equal to the length of l. If the number of nodes in the linked list is not a multiple of k, then the nodes that are left out at the end should remain as-is. You may not alter the values in the nodes - only the nodes themselves can be changed.arrow_forward
- Which one is the key thing in backtracking? Insertion Recursion Submission In what manner is a state-space tree for a backtracking algorithm constructed? Depth-first search Breadth-first search Twice around the tree Nearest neighbour first What does the following function do? int fun(int x, int y) { if (y == 0) return 0; return (x + fun(x, y-1)); } x + y x + x*y x*y xy Consider the following recursive function fun(x, y). What is the value of fun(4, 3) int fun(int x, int y) { if (x == 0) return y; return fun(x - 1, x + y); } 10 9 13 12 Predict output of following program 16 4 Runtime Error 8 Assume you have the following backtracking based sorting algorithm:bool Backtracking_Sort(sorted_list, unsorted_list, index, length) { if (index == length) { return true; } Potential_values = []; If (index != 0) {Potential_values = get_larger_unused_values(sorted_list, unsorted_list, index);} else { Potential_values = copy(unsorted_list);}…arrow_forwardSuppose we want to use UCS and the A* algorithm on the graph below to find the shortest path from node S to node G. Each node is labeled by a capital letter and the value of a heuristic function. Each edge is labeled by the cost to traverse that edge. Perform A*, UCS, and BFS on this graph. Indicate the f, g, and h values of each node for the A*. e.g., S = 0 + 6 = 6 (i.e. S = g(S) + h(S) = f(S)). Additionally, show how the priority queue changes with time. Show the order in which the nodes are visited for BFS and UCS. Show the path found by the A*, UCS, and BFS algorithms on the graph above. Make this example inadmissible by changing the heuristic value at one of the nodes. What node do you choose and what heuristic value do you assign? What would be the A* algorithm solution then.arrow_forwardConsider the 8-puzzle problem. Trace out the A* algorithm given the initial and goal states below. You are supposed to show the generated search tree until the search generates the goal state. For each state show the value of the evaluation function f(n) = g(n) + h(n). Recall that g(n) gives the path cost from the initial state to node n. Moreover, for this problem the step cost is 1 for any action (moving the empty tile). As a heuristic let h(n) be the number of misplaced tiles. Hence f(initial-state) = 0 + 3 = 3. The # symbol denotes the empty tile. Initial State Goal State 1 2 3 1 2 3 # 4 6 4 5 6 7 5 8 7 8 #arrow_forward
- Solve those Two questions: i)- Write an algorithm to find the longest path in a DAG, where the length of the path is measured by the number of edges that it contains. What is the asymptotic complexity of your algorithm? ii) - Write an algorithm to find a maximum cost spanning tree, that is, the spanning tree with highest possible cost.arrow_forwardAn Unfair AlgorithmFinding the MWM of a graph is as easy as selecting edges from a list in order, including the edge in matching, and removing all neighbouring edges from the list. This is done by sorting edges according to their weights in a non-increasing sequence. 1. Input: A weighted graph G = (V, E, w)2. Output: A maximal weighted matching M of G 3. M ← Ø 4. sort E and store the list in Q 5. while Q = Ø6. remove first element e from Q7. M ← M ∪ e8. Q ← Q\ { all adjacent edges to e }Let's attempt to use the preceding methods to create this algorithm in Python.arrow_forwardGiven a jungle matrix NxM: jungle = [ [1, 0, 0, 0], [1, 1, 0, 1], [0, 1, 0, 0], [1, 1, 1, 1,] ] Where 0 means the block is dead end and 1 means the block can be used in the path from source to destination. Task: Starting at position (0, 0), the goal is to reach position (N-1, M-1). Your program needs to build and output the solution matrix – a 4x4 matrix with 1’s in positions used to get from the starting position (0,0) to the ending position (N-1,M-1) with the following constraints: You can only move one space at a time You can only in two directions: forward and down. You can only pass thru spaces on the jungle matrix mark ' 1 ' If you cannot reach the ending position - print a message that you're trapped in the jungle Algorithm: If destination is reached print the solution matrix Else Mark current cell in the solution matrix Move forward horizontally and recursively check if this leads to a solution If there is no solution, move down and recursively check if this leads to…arrow_forward
- Consider the navigation problem shown in Figure 1. The number next to each edge is the cost of the performing the action corresponding to that edge. You start from A and your goal is to get to F. List the order in which nodes are expanded, which nodes are added to the fringe and which states are added to the closed set when performing Graph Search using: breadth-first search. depth-first search. iterative deepening search. uniform cost searcharrow_forwardThe algorithm consists of the following steps.1. Input: A weighted graph G = (V, E, w)2. Output: A maximal weighted matching M of G3. M ← Ø4. E ← E5. V ← V6. while E = Ø7. select at random any v ∈ V8. let e ∈ E be the heaviest edge incident to v9. M ← M ∪ e10. V ← V {v}11. E ← E \ {e and all adjacent edges to e}make two ways of implementing this algorithm in Python. don't copy bartleby old answer its wrong need correct ans otherwise you will get downvotearrow_forwardYou will analyze three algorithms to solve the maximum contiguous subsequence sum problem, and then evaluate the performance of instructor-supplied implementations of those three algorithms. You will compare your theoretical results to your actual results in a written report. What is the maximum contiguous subsequence sum problem? Given a sequence of integers A1, A2, ..., An (where the integers may be positive or negative), find a subsequence Aj, ... , Ak that has the maximum value of all possible subsequences. The maximum contiguous subsequence sum is defined to be zero if all of the integers in the sequence are negative. Consider the sequence shown below. A1: -2 A2: 11 A3: -4 A4: 13 A5: -5 A6: 2 The maximum contiguous subsequence sum is 20, representing the contiguous subsequence in positions 2, 3, and 4 (i.e. 11 + (-4) + 13 = 20). The sum of the values in all other contiguous subsequences is less than or equal to 20. Consider a second sequence, shown below. A1: 1…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education