Create an n by m array

Assignment Help Basic Computer Science
Reference no: EM13165712

Create an n by m array (n, m input by user). Initialize all cells in array to 0. The bug starts at cell 1,1. The bug can jump from its cell to any neighboring cell (left, right, up, down, diagonal) -- so there are at most 8 neighboring cells. Though, for example, cell 1, 1, has only 3 neighboring cells, If the bug tries to jump of of the array, ignore that move. A move is determined by generating a random number between 1 and 8.

1 -- jump left
2 -- jump right
3 -- jump up
4 -- jump down
5 -- jump up and right
6 -- jump up and left
7 -- jump down and right
8 -- jump down and left

Count how many moves it takes until the bug has visited each cell at least once. Display the array after each move, with a count for each cell of how many times the bug has visited that cell as well as what is the bug's current location.

Reference no: EM13165712

Questions Cloud

A[0..n-1] and b[0...n-1] are sorted arrays : A[0..n-1] and B[0...n-1] are sorted arrays where each contains n numbers. Design an O(n*log(n)) algorithm to find the median of all elements in arrays X and Y.
Evaluate the molarity of the hcl solution : How many mmoles of HCl reacted with the Na2CO3? c. Calculate the molarity of the HCl solution.
State what is the order of the reaction with respect to h2o2 : If a second experiment is done with half as much H2O2 as the experiment in question 1, and the solution turns blue in 180 seconds, what is the order of the reaction with respect to H2O2?
State potassium iodide required sodium thiosulfate titrant : In an acidic solution (with an excess of iodate), the titration of a 25 mL sample of potassium iodide required 26.51 mL of 0.0949M sodium thiosulfate titrant.
Create an n by m array : Create an n by m array (n, m input by user). Initialize all cells in array to 0. The bug starts at cell 1,1. The bug can jump from its cell to any neighboring cell (left, right, up, down, diagonal) -- so there are at most 8 neighboring cells. Thou..
Disubstituted alkene was formed in which the olefinic proton : disubstituted alkene was formed in which the olefinic protons exhibited a vicinal coupling of 9.0Hz in the H NMR. What is the stereochemistry
Marie program that will input a variable : To develop a MARIE program that will input a variable number of user entered Decimal whole number grades, validating each one (0-100) in a subroutine
Write a function that computes length of a character string : Write a function that computes the length of a character string (i.e. write your own implementation of the strlen function.
State hydrangeas are flowers that retain blue coloration : Hydrangeas are flowers that retain blue coloration when grown in acidic soil and pink when grown in neutral or alkaline soil

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Consider a 2-dimensional mesh

Consider a 2-dimensional mesh with n^2 nodes. The shortest distance that a message travels in the mesh is 1 link; the longest distance is 2(n-1) link

  Explain johnson-johnson-s approach for it infrastructure

Discuss Johnson & Johnson's Approach ro providing an IT infrastructure to support its one-face-to-the-customer strategy?

  Compute probability distribution and conditional probability

Write down solution this question in cryptographic. Assume encryption function is defined compute probability distribution and conditional probability distribution.

  Investigate project management body of knowledge

Investigate Project Management Body of Knowledge (PMBoK). Write a report on one of knowledge areas. Describe the task of understanding potential threats

  Investigation-woman having inappropriate files on computer

Young woman who was fired from her job for inappropriate files discovered on computer, and she swears she never accessed files. What questions must you ask and how should you proceed?

  Employees may work from home

Employees may work from home up to 15 hours per week. Each project leader needs a list of current means of contacting each member of the project team: home phone and home FAX number. To contact employees "on the road" the project leaders also need..

  Importance of top management commitment

Discuss the importance of top management commitment and the development of standards for successful project management. Provide examples to illustrate the importance of these items.

  Types of systems that benefit from dhcp

Consider the types of systems that benefit from DHCP reservations and/or from having manually-configured (static) IP addresses, including servers, networked printers, and other networked devices (e.g., network-connected HVAC controllers, IP camera..

  Verify local police department-s findings on current case

Your computer investigation firm has been hired to verify local police department's findings on current case. Tension over the case is running high in the city.

  Derive expression for the effective mips rate

Derive an expression for the effective MIPS rate when using this system for the execution of this program in terms of x, n and α.

  Make a c program using cramers rule using 3 variables and eq

make a C program using cramers rule using 3 variables and 3 equations. I need help why the third variable says it isnt initialized and allow the the determinents to be calculated. also i need help making a menu allowing the user to make a start the p..

  Read in information systems

Discuss communication in Unix vs other communication tools we use outside of the operating system (example:text, IM). Discuss anything you have read in Information Systems this past week or tell me what is on your mind about Information Systems.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd