Question

Let A = (A1, A2, A3,.....Ai) be defined as a sequence containing positive and negative integer numbers.

A substring is defined as (An, An+1,.....Am) where 1 <= n < m <= i.

Now, the weight of the substring is the sum of all its elements.

Showing your algorithms and proper working:

1) Does there exist a substring with no weight or zero
weight?

2) Please list the substring which contains the maximum weight
found in the sequence.

Answer #1

**Part 1 :**

**Algorithm :**

func (A) :

Let A be an input Array

1.Run loop i from 0 to leangth of Array A

2.Initialize sum=0

3.Run loop j from i to length of Array A

4.Add element at jth index of A to sum

5. If sum ==0 then print "Substring exist" and come out of the
function 'func'.

6. End of j loop

7. End of i loop

8. print "No such substring exist"

**Note=>** I am adding python code so as to
explain the algorithm in a better way and to show outputs as
well.

**Code and Outputs :**

Output 2:

**Part 2 :**

**Algorithm :**

func (A) :

Let A be an input Array

1. Initialize max value as first element of Array A, index start as
0 and index end as 0

1.Run loop i from 0 to leangth of Array A

2.Initialize sum=0

3.Run loop j from i to length of Array A

4.Add element at jth index of A to sum

5. If sum is greter tha max value then make max=sum , starting
index 'start' = i and last index 'last' =j

6. End of j loop

7. End of i loop

8. print substring starting from index start to index end

**Code and Outputs :**

**Output 2 :**

2. Exercise 19 section 5.4. Suppose that a1, a2, a3, …. Is a
sequence defined as follows:
a1=1 ak=2a⌊k/2⌋ for every integer k>=2.
Prove that an <= n for each integer n >=1.
plzz send with all the step

1. (24 pts.) For which integer values of the constant k does the
sequence {a1, a2, a3, . . .} defined by
an = (5n^k + 3)/(3n^k + 5)
converge? For those values of k, compute the limit of the
sequence {a1, a2, a3, . . .}.

1) Suppose a1, a2, a3, ... is a sequence of integers such that
a1 =1/16 and an = 4an−1. Guess a formula for an and prove that your
guess is correct.
2) Show that given 5 integer numbers, you can always find two of
the numbers whose difference will be a multiple of 4.
3) Four cats and five mice form a row. In how many ways can they
form the row if the mice are always together?
Please help...

A sequence is defined by a1=2 and an=3an-1+1. Find the sum
a1+a2+⋯+an

10. Let P(k) be the following statement: ”Let a1, a2, . . . , ak
be integers and p be a prime. If p|(a1 · a2 · a3 · · · ak), then
p|ai for some i with 1 ≤ i ≤ k.” Prove that P(k) holds for all
positive integers k

Consider the sequence defined recursively by
an+1 = (an + 1)/2 if an is an odd number
an+1 = an/2 if an is an even number
(a) Let a0 be equal to the last digit in your student number,
and compute a1, a2, a3, a4.
(b) Suppose an = 1, and find an+4.
(c) If a0 = 4, does limn→∞ an exist?

Consider the following sequence: 0, 6, 9, 9, 15, 24, . . .. Let
the first term of the sequence, a1 = 0, and the second, a2 = 6, and
the third a3 = 9. Once we have defined those, we can define the
rest of the sequence recursively. Namely, the n-th term is the sum
of the previous term in the sequence and the term in the sequence 3
before it: an = an−1 + an−3. Show using induction...

Let (a_n)∞n=1 be a sequence defined recursively by a1 = 1, a_n+1
= sqrt(3a_n) for n ≥ 1. we know that the sequence converges. Find
its limit.
Hint: You may make use of the property that lim n→∞ b_n = lim
n→∞ b_n if a sequence (b_n)∞n=1 converges to a positive real
number.

In mathematics, the Fibonacci numbers are the numbers in the
following integer sequence, called the Fibonacci sequence, and
characterized by the fact that every number after the first two is
the sum of the two preceding ones:
1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …
The sequence Fn of Fibonacci numbers is defined by
the recurrence relation:
Fn = Fn-1 + Fn
with seed values F1 = 1 F2 = 1
For more information on...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 7 minutes ago

asked 1 hour ago

asked 2 hours ago

asked 3 hours ago

asked 3 hours ago

asked 3 hours ago

asked 4 hours ago

asked 4 hours ago

asked 4 hours ago

asked 4 hours ago

asked 4 hours ago

asked 4 hours ago