Homework Assignment 1 - Complexity and ADTs - ALL ANSWERS ARE CORRECT
1 view 0 purchase
Course
CS 605.202
Institution
CS 605.202
Homework Assignment 1 - Complexity and ADTs
Q1 - Q4 are related to the ADT material. In the lecture, we talked about "outside the black box" and
"inside the black box". The related discussion question will give you some practice with working
"outside the black box". The assignment is intended to...
homework assignment 1 complexity and adts q1 q4 are related to the adt material in the lecture
we talked about outside the black box and i
Written for
CS 605.202
All documents for this subject (3)
Seller
Follow
ExamsConnoisseur
Reviews received
Content preview
Homework Assignment 1 - Complexity and ADTs
Q1 - Q4 are related to the ADT material. In the lecture, we talked about "outside the black box" and
"inside the black box". The related discussion question will give you some practice with working
"outside the black box". The assignment is intended to help you think about "inside the black box", by
having you look at alternative representations. In Q1, you look at an alternative to binary. In Q2, you
look at an where stuff might be stored as a consequence of a selected implementation. In Q3 and Q4,
you look at an alternative data structures to leverage the fact that many locations in a standard array
might always be empty. In Q6 and Q7 you look at how the time is affected by the underlying cost of the
algorithm. Question 4 is extra credit.
1. Show how nonnegative numbers can be represented in an imaginary ternary computer using trits
(0,1,2) instead of bits (0,1). Why don't we do things this way?
There are no nonnegative integers that can be represented using ternary notation and trits that
cannot be represented using binary notation and bits. There are also no nonnegative integers that
can be represented using bits that cannot be represented using trits.
Why don’t we do things this way?
Binary computers are more common than ternary computers because a computer is an electrical
device whose components are capable of two states only - on or off. Since the computer’s memory is
simply a group of switches that may be only on or off, any bit of information stored in the computer at
any time must have one of two mutually exclusive values : 1 (on) or 0 (off).
2. If each element of an array RM,with 10 rows and 20 columns, stored in row major order, takes
four bytes of space, where the first element of RM starts at 100, what is the address of RM[5][3] and
RM[9][19]?
Using the zero-based arrays common to current programming languages: RM[5][3] :
100 + (5 * 20 * 4) + (3 * 4) = 512
RM[9][19] : 100 + (9 * 20 * 4) + (19 * 4) = 896
The benefits of buying summaries with Stuvia:
Guaranteed quality through customer reviews
Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.
Quick and easy check-out
You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.
Focus on what matters
Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!
Frequently asked questions
What do I get when I buy this document?
You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.
Satisfaction guarantee: how does it work?
Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.
Who am I buying these notes from?
Stuvia is a marketplace, so you are not buying this document from us, but from seller ExamsConnoisseur. Stuvia facilitates payment to the seller.
Will I be stuck with a subscription?
No, you only buy these notes for $7.99. You're not tied to anything after your purchase.