Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a function using pseudocode in C++ that would return a peaky string in an array of strings. The function takes in as input an

Write a function using pseudocode in C++ that would return a "peaky string" in an array of strings. The function takes in as input an array of strings and returns a "peaky string". A "peaky string" is defined as a string whose length is greater than the length of both the strings which are adjacent to this string. For strings that are at the boundaries of an array, a "peaky string" must have length greater than one adjacent string. Also, state and explain the worst case time complexity of your solution in terms of Big O using appropriate variables, justifying your rationale .

Example 1:

apple banana pineapple coconut cocoa pear In this array,

"pineapple" is the only "peaky string".

Example 2:

apple banana pineapple coconut cocoa dragonfruit

In this array, "pineapple" and "dragonfruit" are "peaky strings.

You can return any of them but not both.

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

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992