url request to explain below

Posted on 2004-10-01
Medium Priority
Last Modified: 2006-11-17
1. Assume you have an input stream '1 2 3 4 5 6' reading from left to right. By using (1) a queue and (2) a deque, which of the following rearrangements can be obtained for output, reading from left-to-right?

a)  1 2 3 4 5 6           b) 2 4 3 6 5 1         c) 1 5 2 4 3 6
d)  4 2 1 3 5 6           e) 1 2 6 4 5 3         f) 5 2 6 3 4 1

2. Compute log2 1000 if all you know is log2 10. Show your work and justify why it is correct.

3. Show how logs "turn" multiplication into addition, division into subtraction, and exponentiation into multiplication.

4. A fully populated binary tree has all nodes (vertices) present. Assuming a tree with one node has height 1, what is the height of a fully populated tree with n nodes? A well-behaved binary tree may not have all levels fully populated, but all leaves in the tree will be on the same or on adjacent levels. What is the height of a well-behaved binary tree with n nodes? (hint: use the floor or ceil function from the math library.)

Question by:edelossantos
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 33

Assisted Solution

snoyes_jw earned 200 total points
ID: 12203841
Surely this is homework...  We cannot do homework on this site, though if you show us your work and ask a question, we can help you over a hurdle.
LVL 24

Assisted Solution

SunBow earned 600 total points
ID: 12205384
hmmmmm                                                                                                    <sigh>
                                               ahaa! Got one...

2. All should be looked up in a table of numbers.  Work is shown in existence of table. It is correct, because computes that use tables take less time, doing simple lookups, than depending on use of formula using other criteria.

Just remember, being right does not help in life, and that includes getting a grade. It only helps you do do better in your own way.  I doubt a grader would ever care for a SunBowian response.
LVL 11

Accepted Solution

bcladd earned 1200 total points
ID: 12205579

(1) What sequence of enqueue and dequeue operations can you perform with a queue where the items arrive in the given order? The order of dequeuing operations is the order of items in the output.

Consider the same thing with the deque BUT remember that a deque can service entries at either end. Can you come up with a sequence of arrivals and services (from either end) to come up with each/any of the patterns?

(You might also want to think about what output orders you could generate with a stack...the answers are all three related.)

(2) and (3) are intimately related. Start by writing down the definition of log and thinking about it. Show us some work you have done and we can help.

(4) This one is fun. Draw some full trees to get the first answer (you are looking for patterns). Then think about how few nodes would fit in a well-behaved tree of height k (I know, backwards...think about it, though). Then look for the equation relating the two (nodes and heights) and remember the hint to use floor and ceil.

Show us the progress you are making on this homework and we would be happy to make comments.


Author Comment

ID: 12206001
Excellent, thank you.  I will re-post my work to this question.  Regards. Del

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever thought of installing a power system that generates solar electricity to power your house? Some may say yes, while others may tell me no. But have you noticed that people around you are now considering installing such systems in their …
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Suggested Courses

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question