Development of the exhibit in William's cell machine happens iteratively in the accompanying manner:    In the event that the component is dead and it has precisely 1 alive neighbor in the present status of the exhibit, then, at that point, on the following emphasis it will become alive. For a component

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Computer science. Correct answer will be upvoted else downvoted.

 

 

Development of the exhibit in William's cell machine happens iteratively in the accompanying manner: 

 

In the event that the component is dead and it has precisely 1 alive neighbor in the present status of the exhibit, then, at that point, on the following emphasis it will become alive. For a component at list I the neighbors would be components with files i−1 and i+1. In case there is no component at that list, it is viewed as a dead neighbor. 

 

William is a sympathetic individual so all alive components stay alive. 

 

Check the note area for instances of the advancement. 

 

You are given some underlying condition, everything being equal, and you really wanted to help William discover the condition of the cluster after m emphasess of advancement. 

 

Input 

 

Each test contains various experiments. The principal line contains the number of experiments t (1≤t≤103). Depiction of the experiments follows. 

 

The primary line of each experiment contains two integers n and m (2≤n≤103,1≤m≤109), which are the all out number of cells in the exhibit and the number of emphasess. 

 

The second line of each experiment contains a line of length n comprised of characters "0" and "1" and characterizes the underlying condition of the cluster. "1" signifies a cell is alive and "0" signifies it is dead. 

 

It is ensured that the amount of n over all experiments doesn't surpass 104. 

 

Output 

 

In each experiment output a line of length n, comprised of characters "0" and "1" — the condition of the exhibit after m cycles of development.

Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education