Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming language C EXERCISE 2 (subseq.c) Write a program to find the longest continuous increasing subsequence. For example, if the input is [1,3,5,4,7] The longest

Programming language C
image text in transcribed
EXERCISE 2 (subseq.c) Write a program to find the longest continuous increasing subsequence. For example, if the input is [1,3,5,4,7] The longest continuous increasing subsequence is [1,3,51. Even though [1,3,5,7] is also an increasing subsequence, it's not a continuous one where 5 and 7 are separated by 4. If the input is [2,2,2,2,2], the longest continuous increasing subsequence is [2], its length is 1 In your program, the user will enter data ended with -1. The number of data is no more than 30. Your program should print the index range of the longest subsequence, followed by the accrual data, followed by the sequence size For example, if user enters 1 3 5 47-1, You program should print: [0.2:[1,3,5]:3 Please follow the above print format exactly. The data should be separated with . There is no comma (.) after the last number If there are multiple increasing subsequence with same length, the first one from left should be reported. Example of outputs $ ./subseq 2 2 2 2 2-1 [0..01 (21:1 $ ./subseq 1 3 547 -1 $ ./subseq 1 3 5 4 7 8 10 2 -1 [3..6]:[4,7,8,101:4 ./subseq 7 8561 3 -1 /subseq 6 5 4-1 data[0. .0] : [6] :1

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions

Question

1.who the father of Ayurveda? 2. Who the father of taxonomy?

Answered: 1 week ago