+1 (845) 317-8489 [email protected]

1.Suppose you have some algorithm with the running time T=O(n2).

 How much slower does this algorithm get when you:

 

(a) Double the input size

 

(b) Increase the input size by one?

 

 

 

2. How could either a Stack or a Queue be used to reverse strings of text?

 

Consider some string like, “This is a string of text”.

 

Create pseudo code to take in a string, insert each symbol into a stack/queue, using the

 

stack/queue generate the reverse string.

 

Provide only the pseudo code for this question.

 3. Which data structure did you use for the previous question? A stack or queue?

 

 

 

Justify your answer. Explain why this structure would allow the reversal of a string while

 

the other data structure would not.