Suppose now that you're given an n × n grid graph G (An n n grid graph is just the adjacency graph of an n x n chessboard. To be completely precise, it is a graph whose node set is the set of all ordered pairs of natural numbers (i, j), where 1-i < n and 1 < j < n; the nodes (i, j) and (k, 1) are joined by an edge if and only if i-k+j-1 1.) We use some of the terminology of the previous qestion. Again, node v is labeled by a real number re; you may assume that all these labels are distinct. Show how to find a local minimum of G using only O(n) probes to the nodes of G, where G has n2 nodes. What is the run time of your algorithm?

Q&A Education