Assume that you are given a maze (shown on the right) which is stored in an...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Assume that you are given a maze (shown on the right) which is stored in an array called maze as shown in the code below. Write a piece of code that determines the number of dead-ends in the maze. A dead-end is a location that has exactly three walls around it in the up/down/left/right directions (see the 7 circles in image). Your code should count the dead-ends and display the total. Your code must work for any maze, not just this one. You may assume that the maze only contains 1's and 0's, that the other borders are all 1's and that the maze is always of size 10x10. Paragraph char B I U v A/ maze [10] [10] = {(1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, (1, 0, 0, 1, 0, 0, 0, 0, 0, 1}, (1, 1, 0, 1, 0, 1, 1, 1, 1, 1), (1, 1, 0, 0, 0, 1, 0, 0, 0, 1), (1, 1, 1, 0, 1, 1, 1, 1, 0, 1), (1, 0, 0, 0, 0, 0, 0, 0, 0, 1), (1, 1, 1, 1, 1, 0, 0, 1, 1, 1), (1, 0, 0, 0, 0, 0, 1, 0, 0, 1), (1, 0, 1, 0, 1, 0, 0, 0, 1, 1), AO FO 4 0 + X 4 11. Spend at most 3 minutes on this. Convert 17E Hex to Decimal. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Spend at most 3 minutes on this. Convert 11101 Binary to Decimal. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Spend at most 3 minutes on this. Convert 53 Octal to Decimal. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Spend at most 3 minutes on this. Convert 76 Decimal to Binary. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Assume that you are given a maze (shown on the right) which is stored in an array called maze as shown in the code below. Write a piece of code that determines the number of dead-ends in the maze. A dead-end is a location that has exactly three walls around it in the up/down/left/right directions (see the 7 circles in image). Your code should count the dead-ends and display the total. Your code must work for any maze, not just this one. You may assume that the maze only contains 1's and 0's, that the other borders are all 1's and that the maze is always of size 10x10. Paragraph char B I U v A/ maze [10] [10] = {(1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, (1, 0, 0, 1, 0, 0, 0, 0, 0, 1}, (1, 1, 0, 1, 0, 1, 1, 1, 1, 1), (1, 1, 0, 0, 0, 1, 0, 0, 0, 1), (1, 1, 1, 0, 1, 1, 1, 1, 0, 1), (1, 0, 0, 0, 0, 0, 0, 0, 0, 1), (1, 1, 1, 1, 1, 0, 0, 1, 1, 1), (1, 0, 0, 0, 0, 0, 1, 0, 0, 1), (1, 0, 1, 0, 1, 0, 0, 0, 1, 1), AO FO 4 0 + X 4 11. Spend at most 3 minutes on this. Convert 17E Hex to Decimal. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Spend at most 3 minutes on this. Convert 11101 Binary to Decimal. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Spend at most 3 minutes on this. Convert 53 Octal to Decimal. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40 Spend at most 3 minutes on this. Convert 76 Decimal to Binary. You MUST show how you arrived at your answer if you want any marks. For example, if you are given 10100 binary and need to convert to decimal, your answer should be like this: = 1x2^5 + 1x2^3 = 1x32 + 1x8 = 40
Expert Answer:
Related Book For
Data Structures and Algorithm Analysis in Java
ISBN: 978-0132576277
3rd edition
Authors: Mark A. Weiss
Posted Date:
Students also viewed these algorithms questions
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Let A, B be sets. Define: (a) the Cartesian product (A B) (b) the set of relations R between A and B (c) the identity relation A on the set A [3 marks] Suppose S, T are relations between A and B, and...
-
A random sample of 100 students was taken from a large university to study the relationship between GPA and the number of hours of study per week. The following linear regression equation was...
-
Profile Mark Zuckerberg using the four elements of core self-evaluations. Indicate whether he is high, medium, or low on each.
-
It has been estimated that there are 270 million plug-in electric clocks in the United States, approximately one clock for each person. The clocks convert energy at the average rate of 2.50 W. To...
-
Jupiter, with an inertia 317.83 times that of Earth, is at an average distance of \(7.784 \times 10^{11} \mathrm{~m}\) from the Sun. At what distance from the centre of the Sun is the center of mass...
-
Ellis issues 6.5%, five- year bonds dated January 1, 2013, with a $ 250,000 par value. The bonds pay interest on June 30 and December 31 and are issued at a price of $ 255,333. The annual market rate...
-
QUESTION FOUR The increasing demand in risk management on the part of organizations has been identified as a general societal trend emphasizing public accountability and responsibility. State and...
-
Consider the following separate cases pertaining to Audit Opinions: (a) You have audited Froggy No 1 Ltd. During the audit you discover that a material amount of inventory is held in a robotic...
-
Based on the information provided , identify and discuss one most important business risks faced by the firm. - Business risk chosen: Global Pandemic Marking Criteria: - Business risks reflect a...
-
Estimation of future project cash flows using only the relevant parts of the financial statements Ascertaining how an action would affect a firm's taxes Comparing the financial statements from one...
-
Creation of Digital Files Prepare an analysis report for the capital expenditure decision. Once completed, publish the created file online for a board audience using open source repositories with...
-
Suppose f(7) = 9, f'(7) = 3, g(7) = 5, and g'(7) = 6. Find h(7) and h'(7), where h(x) = 4f(x) + 5g(x). h(7) = (Simplify your answer.) ...
-
What are the most used and most important financial statements in a nonprofit and for profit company? Why, be very detailed.
-
To what extent do you agree that When an apple is rotten there is no cure, but at least the rotten apple can be removed before the contagion spreads and infects the whole basket. This is really what...
-
Do public and private companies follow the same set of accounting rules? Explain.
-
If a d-heap is stored as an array, for an entry located in position i, where are the parents and children?
-
Determine, for the typical algorithms that you use to perform calculations by hand, the running time to do the following: a. Add two N-digit integers. b. Multiply two N-digit integers. c. Divide two...
-
Show that the expected depth of the kth smallest element in a large complete heap (you may assume N = 2k 1) is bounded by log k.
-
Using the knowledge you gained from your interview in mini case 1 , design an interface for the individual you interviewed. What interface design modifications are you making so that the program will...
-
A portfolio on the capital market line with returns greater than the returns on the market portfolio represents a(n): A. Lending portfolio. B. Borrowing portfolio. C. Unachievable portfolio.
-
Highly risk-averse investors will most likely invest the majority of their wealth in: A. Risky assets. B. Risk-free assets. C. The optimal risky portfolio.
Study smarter with the SolutionInn App