Suppose you have a chess program that can evaluate 10 million nodes per second. Decide on a compact representation of a game state for storage in a transposition table. About how many entries can you fit in a 2-gigabyte in-memory table? Will that be enough for the three minutes of search allocated for one move? How many table lookups can you do in the time it would take to do one evaluation? Now suppose the transposition table is stored on disk. About how many evaluations could you do in the time it takes to do one disk seek with standard disk hardware?
Want to see the full answer?
Check out a sample textbook solutionChapter 5 Solutions
Artificial Intelligence: A Modern Approach
Additional Engineering Textbook Solutions
C Programming Language
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
C++ How to Program (10th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Starting Out with C++: Early Objects (9th Edition)
Introduction To Programming Using Visual Basic (11th Edition)
- Can you answer with the Python programming language without using input ? A 2D matrix can be represented as a list and a column count value in Python. For example, the 3x3 matrix 1 2 3 4 5 6 7 8 9 can be row-wise represented as ([1,2,3,4,5,6,7,8,9], 3), where the number 3 represents the number of columns in the matrix. Similarly, 1 3 5 2 4 6 becomes ([1,3,5,2,4,6], 3). A submatrix can be defined as an (l,r,t,b) tuple, where l and r are left and right column indices, and t and b are top and bottom row indices (all inclusive). Write a function that takes a tuple containing the list representing a matrix, and the column count of the matrix, along with another tuple representing a specific submatrix, and returns the list representation of the submatrix along with its column count as a tuple. For example, given submatrix(([1,2,3,4,5,6,7,8,9,10,11,12], 4), (1,2,0,1)) returns: ([2,3,6,7], 2) because, ([1,2,3,4,5,6,7,8,9,10,11,12], 4) represents: 1 2 3 4 5 6 7 8 9 10 11 12 and (1,2,0,1)…arrow_forwardIn dynamic programming with memoization, what is the complexity of the memo data structure lookup and insert operations? a. lookup: 0(1), insert: 0(1) Ob. lookup: e(n), insert: 0(n) c. lookup: e(n), insert: 0(1) d. lookup: 0(1), insert: 0(n) e. lookup: 0(1), insert: 0( log n)arrow_forwardThe puzzle called the Towers of Hanoi consists of three pegs, one of which contains several rings stacked in order of descending diameter from bottom to top. The problem is to move the stack of rings to another peg. You are allowed to move only one ring at a time, and at no time is a ring to be placed on top of a smaller one. Observe that if the puzzle involved only one ring, it would be extremely easy. Moreover, when faced with the problem of moving several rings, if you could move all but the largest ring to another peg, the largest ring could then be placed on the third peg, and then the problem would be to move the remaining rings on top of it. Using this observation, develop a recursive algorithm for solving the Towers of Hanoi puzzle for an arbitrary number of rings.arrow_forward
- A graph is a collection of vertices and edges G(V, E). A weighted graph has weights (numbers, etc.) on every edge. A multigraph can have more than one edges between any vertices. Explain why a person should use a weighted graph instead of a multigraph. Give examples. An adjacency matrix might be a better choice for speeding up a program, however, it consumes huge memory for large graphs. How this situation can be improved? What programming constructs better suit graph representation? Explain with examplearrow_forwardImplementing matrix addition is pretty simple; see the program below. However, the given addition function matrix_add_double() does not run at full speed. On the instructors computer, which has 16GB of RAM, the program below shows that the call to matrix_add_double takes 38571 ms, while another, better implementation achieves the same result in 3794.7ms, which is 10.2 times faster! Your job for this exercise is: • to explain what in the Operating System and/or CPU and/or other part of the system makes the implementation below go so slowly. • to fix the code to achieve full speed. Hint: There are two reasons why the code runs slowly. The one reason is related to how virtual addresses get translated to physical addresses, the other reasons is related to another effect in the hardware. Only the performance for the matrix_add_double function() counts for your exam results. You can leave the other parts of the code untouched, but you may also change them.…arrow_forwardusing Python programming language. The Towers of Hanoi is a classic puzzle that consists of 3 towers, and n disks of different sizes that can slide onto any tower. The puzzle starts with the disks sorted in ascending order of size from top to bottom. It has the following constraints:a. Only one disk can be moved at a time.b. A disk can only be moved from the top of one tower to another tower.c. A disk can only be placed on top of a larger disk. Write a pseudo-code.arrow_forward
- Create a BST implementation that uses three arrays to represent the BST: one with keys, one with array indices for left links, and one with array indices for right links. The arrays should be preallocated to the maximum size specified in the constructor. Compare your program's performance against that of the usual implementation.arrow_forwardImplement a program that will populate a 6x5 matrix with randomly generated integers from 100 to 500. (1) print your matrix in a table form. (2) modify your code to multiply all odd numbers by 2 and print the matrix. Sample run: Initial Matrix: 145 | 437 | 222 | 101 | 100 | 278 500 | 190 | 415 | 288 | 466 322 377 | 240 | 451 | 331 186 186 432 102 | 106 | 105 249 248 | 117 | 213 | 499 488 355 | 266 | 396 | New Matrix: 290 | 874 | 222 | 101 | 100 | 278 500 | 190 | 830 288 | 466 322 754 | 240 | 902 | 662 186 432 | 102 | 106 | 210| 498 248 | 234 | 426 | 998 488 710 | 266 | 396 |arrow_forwardThe way the Spaghetti Sort algorithm "cheated", if it did, was in claiming that the operation of my left hand's palm detecting the tallest remaining piece of spaghetti in my right hand, and then pulling it out, could be accomplished in O(1) time, without explaining how this would actually be implemented algorithmically. If you wanted to fill in the details for how this would work, one of the big decisions to make would be to choose the data structure you use to implement the fist of spaghetti, and there are several potential options (though they won't of course provide the desired O(1) time). Note that in the course of the algorithm running, first you would insert all the numbers (spaghetti pieces) into the data structure, and then you would repeated delete the largest remaining number (tallest remaining piece of spaghetti) from it. a) If you used an unsorted array as the data structure, what would the big-O cost of each delete-max operation be? b) What would the total big-O cost of…arrow_forward
- A 2D matrix can be represented as a list and a column count value in Python. For example, the 3x3 matrix1 2 34 5 67 8 9can be row-wise represented as ([1,2,3,4,5,6,7,8,9], 3), where the number 3 represents the number of columns in the matrix. Similarly,1 3 52 4 6becomes ([1,3,5,2,4,6], 3). A submatrix can be defined as an (l,r,t,b) tuple, where l and r are left and right column indices, and t and b are top and bottom row indices (all inclusive). Write a function that takes a tuple containing the list representing a matrix, and the column count of the matrix, along with another tuple representing a specific submatrix, and returns the list representation of the submatrix along with its column count as a tuple. For example, givensubmatrix(([1,2,3,4,5,6,7,8,9,10,11,12], 4), (1,2,0,1)) returns:([2,3,6,7], 2)because, ([1,2,3,4,5,6,7,8,9,10,11,12], 4) represents:1 2 3 45 6 7 89 10 11 12and (1,2,0,1) represents the submatrix between column indices 1 and 2 (both inclusive), and row indices 0…arrow_forwardThe method to compress an image in image processing is using convolution matrix where the number of outputs is reduced by replacing the matrix multiplication with much smaller kernel matrix. This is illustrated on the figure below. In this example a black and white photograph is scanned as a rectangular array of pixels and then stored as image matrix on the left by assigning each pixel a numerical value in accordance with its gray level, (0 = white to 255 = black), then the entries in the matrix are integers between O and 255.Then multiplication is employed with much smaller kernel matrix in the middle. 0|0 21 00 o 106 85 71 1 250 231 127 63 1 250 252 250 209 56 1 250 252 250 250 83 Kernel 0 0 0 Feature map Image Boxes in red and blue frames indicate how the upper left element is formed by applying the kernel to the corresponding upper left region of the input matrix. The elements of much smaller "feature map" matrix on the right can be calculated from: 3.arrow_forwardSuppose you’re consulting for a bank that’s concerned about fraud detection, and they come to youwith the following problem. They have a collection of n bank cards that they’ve confiscated, suspectingthem of being used in fraud. Each bank card is a small plastic object, containing a magnetic stripe withsome encrypted data, and it corresponds to a unique account in the bank. Each account can have manybank cards corresponding to it, and we’ll say that two bank cards are equivalent if they correspond to thesame account.It’s very difficult to read the account number off a bank card directly, but the bank has a high-tech “equivalence tester” that takes two bank cards and, after performing some computations, determines whether theyare equivalent.Their question is the following: among the collection of n cards, is there a set of more than n/2 of themthat are all equivalent to one another? Assume that the only feasible operations you can do with the cardsare to pick two of them and plug them…arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning