Question

A. Write an algorithm in pseudocode, which prints all strings of length 6 where the first three characters are any symbol from X={!,@,#,$,%,^}, the 4th and 5th characters are any digit 0,1,…9, and the last character is any digit 1,2,…9.

How many times will the print command be called (e.g. how many 6-character strings will be printed)?

B. Let g(n)=n3 + 2n2 - 5. Determine the big-theta estimate of f. A complete response will include analysis of: k3HhXiTAAAAAElFTkSuQmCC, and qAAAAAElFTkSuQmCC.

C. How many compares of the form fExeT3y45evk4AAAAAElFTkSuQmCC   will the following algorithm perform on a list of length n? Express your answer as a rational expression in terms of n.

for 4Pi0+1u0xuwAAAAASUVORK5CYII= do

         for SEargks2AAAAAElFTkSuQmCC do

                 if fExeT3y45evk4AAAAAElFTkSuQmCC then swap 8GYbT8mpCzFa4AAAAASUVORK5CYII= and 0AZF9BIt7GBqkAAAAASUVORK5CYII=

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Sol. Given! prints all strings of length 6. first three characters are any synd for x=!,@,#,#2:1.,1}.. y = {0, 1, 2} Z ={1,2,@ o 2 r for it to length (2) for jki length lyn lr for kal length (3) 6 [print (x(i), y(), alk), x(e)] Given P sendood the prüsn-2 → j =net til i=n-1 ;=$} in total = 0+1+---+(n-3)+(n-2) In-2)(n-2+1) 2 Total = ln-1 (n-3)

Add a comment
Know the answer?
Add Answer to:
A. Write an algorithm in pseudocode, which prints all strings of length 6 where the first...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write in pseudocode an algorithm that receives a graph and a set of vertices and remove...

    Write in pseudocode an algorithm that receives a graph and a set of vertices and remove from . Please note that no edge incident to vertices of can exist after removal. Analyze the execution time of your algorithm if the implementation is done in both representations: adjacency matrix and adjacency list We were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe this imageWe were unable to transcribe...

  • Write a pseudocode description of the printLCS () algorithm, which prints the longest common subs...

    Write a pseudocode description of the printLCS () algorithm, which prints the longest common subsequence of two strings x and y. Your algorithm should take as input the completed ïïcs Π integer array of longest common subsequence lengths, and the two strings x and y. (So, you do not have the path[] [] array - see Lecture 19, slides 100 and 101.) Your algorithm must return the specific string corresponding the length found in 1lcs [n] [m] and it should...

  • solve with python Write a recursive function recStringWithLenCount() that takes a one-dimensional list of strings as...

    solve with python Write a recursive function recStringWithLenCount() that takes a one-dimensional list of strings as a parameter and returns the count of strings that have at least the length of second parameter passed into the function that are found in the list. Recall that you can determine whether an item is a string by writing type(item) == str. The only list functions you are allowed to use are len(), indexing (lst[i] for an integer i), or slicing (lst[i:j] for...

  • Use c-strings for the following project: Write a C++ program that declares an array containing up...

    Use c-strings for the following project: Write a C++ program that declares an array containing up to a maximum of 20 sentences, each sentence of maximum 81 characters long, using c-strings. Continue reading sentences from the user and store them in the array of sentences, until the user enters a NULL string for the sentence or 20 sentences have been entered. Then, one by one, display each sentence entered by the user and present the following menu of operations on...

  • The objective lens of a telescope has a focal length 25 cm and is being used...

    The objective lens of a telescope has a focal length 25 cm and is being used to look at a 50 m-high tree 1 kilometer away. What is the height of the image formed by this telescope lens inside the tube of the telescope? (In mm, closest answer.) AND A radioactive sample has a certain number N of unstable nuclei that are emitting 4.5 MeV gamma rays with a half-life of 1.5 hours. If the rate of radioactive heating of...

  • Objectives: Use strings and string library functions. Write a program that asks the user to enter...

    Objectives: Use strings and string library functions. Write a program that asks the user to enter a string and output the string in all uppercase letters. The program should then display the number of white space characters in the string. You program should run continuously until the user enters an empty string. The program must use the following two functions: A function called count_spaces that counts the number of white spaces inside a string. int count_space(char str[]); which tell you...

  • (1) Give a formula for SUM{i} [i changes from i=a to i=n], where a is an...

    (1) Give a formula for SUM{i} [i changes from i=a to i=n], where a is an integer between 1 and n. (2) Suppose Algorithm-1 does f(n) = n**2 + 4n steps in the worst case, and Algorithm-2 does g(n) = 29n + 3 steps in the worst case, for inputs of size n. For what input sizes is Algorithm-1 faster than Algorithm-2 (in the worst case)? (3) Prove or disprove: SUM{i**2} [where i changes from i=1 to i=n] ϵ tetha(n**2)....

  • 6. Write a function which combines two strings which are passed as 7. The trimLeft) method remove...

    Note: Please test your output on the console and also avoid the functions below. We were unable to transcribe this image6. Write a function which combines two strings which are passed as 7. The trimLeft) method removes whitespace from the left end of a 8. Write a function which removes whitespace from both ends of the parameters. Mix one character from each string and return the concatenated result. function('ABC','Defg) return ADBeCfg string. Whitespace in this context is all the whitespace...

  • Suppose the length of the tube used in our experiment is 4 m and a tuningfork...

    Suppose the length of the tube used in our experiment is 4 m and a tuningfork of frequency 237 H2 is used in air where the speed of sound is 344.0 m/s? (Give your answers as integers. For this question, the length of the tube is of the entire plastic cylinder, and not the adjustable length of the air column) (a) Calculate the number n to find the number of resonances afterwards. n= 1.45 (0) How many resonances will be...

  • In C++ please. Thank you!! #include <iostream> #include <cstring> // print an array backwards, where 'first'...

    In C++ please. Thank you!! #include <iostream> #include <cstring> // print an array backwards, where 'first' is the first index // of the array, and 'last' is the last index void writeArrayBackward(const char anArray[], int first, int last) { int i = 0; for (i = last; i >= first; i--) { std::cout << anArray[i]; } std::cout << std::endl; } // test driver int main() { const char *s = "abc123"; writeArrayBackward(s, 0, strlen(s) - 1); } // Using the...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT