5 Questions for Algorithms and Data Structures - Assignment 2 | CS 303, Assignments of Computer Science

Material Type: Assignment; Class: Algorithms and Data Structures; Subject: Computer Science; University: University of Alabama - Birmingham; Term: Fall 2007;

Typology: Assignments

Pre 2010

Uploaded on 04/12/2010

koofers-user-0jz
koofers-user-0jz 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS303: Algorithms and Data Structures Fall 2007
Assignment 2 (written) Due Date: September 19, 2007 (during lab hours)
1. (15 pts) For what values of N is ?
2
2lg10 NNN >
2. (20 pts) Suppose and
() ()()
NFONT =
1
(
)
(
)
(
)
NFONT
=
2. Can you conclude that
() () ()
1
21 ONTNT =? Justify your answer.
3. (15 pts) From the textbook, exercise 4.6. In the sequence H E L L * O *, a letter means push and an
asterisk means pop. Give a way to insert asterisks in the sequence E A S Y so that the sequence
values returned by the pop operations is (i) E A S Y ; (ii) Y S A E ; (iii) A S Y E ; (iv) A Y E S ; or,
in each instance, prove that no such sequence exists.
4. (30 pts) Show how to implement a queue using two stacks. Analyze the running time of the queue
operations.
5. (20 pts)The human genome is a sequence of roughly 3.5 billion nucleotides, each of which is one of
four types, A, C, G, or T. Representing each of A, C, G, or T as a string of 2 bits, the entire genome
string would take up roughly 0.875 gigabytes of storage, thus would fit comfortably on a laptop hard
disk.
a. (10 pts) Suppose your computer can perform 109 operations per second. Say you wanted to
analyze the genome running a naïve string matching algorithm known to take n2 operations on
inputs of length n. Comment on the feasibility of this.
b. (10 pts) Suppose that by using a more appropriate data structure, your algorithm could perform
the same task using only n lg n operations on inputs of length n. What then?
Note: Answers without any proof or workings won’t count! This question is easier than it looks. Don’t be intimidated by
the amount of text.

Partial preview of the text

Download 5 Questions for Algorithms and Data Structures - Assignment 2 | CS 303 and more Assignments Computer Science in PDF only on Docsity!

CS303: Algorithms and Data Structures Fall 2007 Assignment 2 (written) Due Date: September 19, 2007 (during lab hours)

  1. (15 pts) For what values of N is 10 N lg N > 2 N^2?

2. (20 pts) Suppose T 1 ( N ) = O ( F ( N ))and T 2 ( N ) = O ( F ( N )). Can you conclude that

T 1 ( N ) T 2 ( N ) = O ( ) 1? Justify your answer.

  1. (15 pts) From the textbook, exercise 4.6. In the sequence H E L L * O *, a letter means push and an asterisk means pop. Give a way to insert asterisks in the sequence E A S Y so that the sequence values returned by the pop operations is (i) E A S Y ; (ii) Y S A E ; (iii) A S Y E ; (iv) A Y E S ; or, in each instance, prove that no such sequence exists.
  2. (30 pts) Show how to implement a queue using two stacks. Analyze the running time of the queue operations.
  3. (20 pts)The human genome is a sequence of roughly 3.5 billion nucleotides, each of which is one of four types, A, C, G, or T. Representing each of A, C, G, or T as a string of 2 bits, the entire genome string would take up roughly 0.875 gigabytes of storage, thus would fit comfortably on a laptop hard disk.

a. (10 pts) Suppose your computer can perform 10^9 operations per second. Say you wanted to analyze the genome running a naïve string matching algorithm known to take n^2 operations on inputs of length n. Comment on the feasibility of this.

b. (10 pts) Suppose that by using a more appropriate data structure, your algorithm could perform the same task using only n lg n operations on inputs of length n. What then?

Note: Answers without any proof or workings won’t count! This question is easier than it looks. Don’t be intimidated by the amount of text.