Write a function named checkInterval(cir_arr, size, start, interval) which takes a circular array, its size, start index and an interval variable as parameters. The function checks for negative values at each interval from the start index and if a negative value is found it is replaced with its positive value. The function should print the modified array at the end. The element at the start index is considered to be the first element. Note: Assume that 0 represents empty spaces in the array. [You are not allowed to use any additional array/list or any built-in functions except len(), range()].
Write a function named checkInterval(cir_arr, size, start, interval) which takes a circular array, its size, start index and an interval variable as parameters. The function checks for negative values at each interval from the start index and if a negative value is found it is replaced with its positive value. The function should print the modified array at the end. The element at the start index is considered to be the first element. Note: Assume that 0 represents empty spaces in the array. [You are not allowed to use any additional array/list or any built-in functions except len(), range()].
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
write it in python(hand written) ..
![Question | Midterm Question | CSE2 X
E CSE220 Midterm (Fall 2021)
New Tab
x +
docs.google.com/forms/d/e/1FAlpQLSeTEvIB3|2LFPhufH2ftHX40lekwnvgdgyR27zKsQROQaeoCQ/formResponse
Question 1
Write a function named checkInterval(cir_arr, size, start, interval) which takes a circular
array, its size, start index and an interval variable as parameters. The function checks for
negative values at each interval from the start index and if a negative value is found it is replaced
with its positive value. The function should print the modified array at the end. The element at
the start index is considered to be the first element.
Note: Assume that 0 represents empty spaces in the array.
[You are not allowed to use any additional array/list or any built-in functions except len(), range()].
Sample Input
Sample Output
Explanation
cir_arr=[0,0,-2,4,3,-3,- cir_arr=[0,0,-2,4,3,3,-
5,-6,-7,-10,0,0]
Here, index 2 value is considered as the 1st element and
interval is 2. If the 2nd, 4th, 6th and 8th elements are
negative, they will be replaced with it's positive value.
Hence the 4th (-3), 6th (-6) and 8th (-10) values are
replaced with corresponding positive values.
5,6,-7,10,0,0]
Interval=2
Size = 8
Start = 2
cir_arr=[0,10,-20,3,-
30,-5,-23,70,0,0]
cir_arr=[0,10,-20,3,-30,- | Here, index 1 value is considered as the first element
5,23,70,0,0]
and interval is 3. If the 3rd,6th elements are negative,
they will be replaced with it's positive value. Hence the
6th value (-23) is replaced with corresponding positive
value.
Interval=3
Size = 7
Start = 1](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fee68d55d-9dee-4bb1-88ab-e72e8958bd8c%2Ff930b52b-0758-45d0-ac8d-0c25d7437331%2Fchxb2d_processed.png&w=3840&q=75)
Transcribed Image Text:Question | Midterm Question | CSE2 X
E CSE220 Midterm (Fall 2021)
New Tab
x +
docs.google.com/forms/d/e/1FAlpQLSeTEvIB3|2LFPhufH2ftHX40lekwnvgdgyR27zKsQROQaeoCQ/formResponse
Question 1
Write a function named checkInterval(cir_arr, size, start, interval) which takes a circular
array, its size, start index and an interval variable as parameters. The function checks for
negative values at each interval from the start index and if a negative value is found it is replaced
with its positive value. The function should print the modified array at the end. The element at
the start index is considered to be the first element.
Note: Assume that 0 represents empty spaces in the array.
[You are not allowed to use any additional array/list or any built-in functions except len(), range()].
Sample Input
Sample Output
Explanation
cir_arr=[0,0,-2,4,3,-3,- cir_arr=[0,0,-2,4,3,3,-
5,-6,-7,-10,0,0]
Here, index 2 value is considered as the 1st element and
interval is 2. If the 2nd, 4th, 6th and 8th elements are
negative, they will be replaced with it's positive value.
Hence the 4th (-3), 6th (-6) and 8th (-10) values are
replaced with corresponding positive values.
5,6,-7,10,0,0]
Interval=2
Size = 8
Start = 2
cir_arr=[0,10,-20,3,-
30,-5,-23,70,0,0]
cir_arr=[0,10,-20,3,-30,- | Here, index 1 value is considered as the first element
5,23,70,0,0]
and interval is 3. If the 3rd,6th elements are negative,
they will be replaced with it's positive value. Hence the
6th value (-23) is replaced with corresponding positive
value.
Interval=3
Size = 7
Start = 1
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY