1. Write pseudocode for the algorithm using iteration
(looping).
Envision an algorithm that when given any positive integer n, it
will print out the sum of the squares from 1 to n. For example
given 3 the algorithm will print 14 (because 1 + 4 + 9 =14) You can
use multiplication denoted as * in your solution and you do not
have to define it (For example. 3*3=9) For example if n is 6 it
will print: The sum...
Write a Python program that:
Create the algorithm in both
flowchart and pseudocode forms
for the following requirements:
Reads in a series of positive integers, one number
at a time; and
Calculate the product (multiplication) of all the integers
less than 25, and
Calculate the sum (addition) of all the integers
greater than or equal to 25.
Use 0 as a sentinel value, which stops the input loop. [ If
the input is 0 that means the end of the input list. ]...
Write an algorithm (in pseudocode, with proper indentation for
blocks of code in loops or conditional statements) that finds and
returns the location of the first negative integer in a sequence of
integers.
1a. Write pseudocode for a divide-and-conquer algorithm for
finding the po- sition of the largest element in an array of n
numbers.
5. Find the order of growth for solutions of the following
recurrences.
a . T(n)=4T(n/2)+n,T(1)=1
b. T(n)=4T(n/2)+n2,T(1)=1
c. T(n)=4T(n/2)+n3,T(1)=1
Write an algorithm in pseudocode for the binary search
method using a while loop (iterative version)
The recursive ternarySearch method returns true or false depending
if the element was found or not.
The ternarySearch method works in a similar manner to a binary
search except it uses two mid values that “divide” the array into
three portions. So, it needs to consider three recursive
scenarios:
See sample run:
Accounts are:
[0] 5658845
[1] 8080152
[2] 1005231
[3] 4520125
[4] 4562555...
Write an algorithm in pseudocode for the binary search method
using a while loop (iterative version)
The recursive ternarySearch
method returns true or false depending if the element was found or
not.
The ternarySearch method works in a similar manner to a binary
search except it uses two mid values that “divide” the array into
three portions. So, it needs to consider three recursive
scenarios:
See sample run:
Accounts are:
[0] 5658845
[1] 8080152
[2] 1005231
[3] 4520125
[4] 4562555...
Write an algorithm (flowchart OR Pseudocode) for the following
problem
Take input character from the user unless he enters '$'.
Thereafter display how may vowels were entered by the user. Also
display the number of each vowel ('a', 'e', 'i', 'o' and 'u')
separately.
For example if the user enters B
a
b
e
c
o
o
d
i
u
g
o
a
l
$
Then we have the output below:
#A=2
#E=1
#I=1
#O=3
#U=2
Write pseudocode for an algorithm that calculates the Hamming
distance between two strings s1 and s2 of the same length n. What
is the complexity of your algorithm?