Preview

This Le Contains The Exercises Hints

Powerful Essays
Open Document
Open Document
7778 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
This Le Contains The Exercises Hints
This file contains the exercises, hints, and solutions for Chapter 3 of the book ”Introduction to the Design and Analysis of Algorithms,” 2nd edition, by
A. Levitin. The problems that might be challenging for at least some students are marked by ; those that might be difficult for a majority of students are marked by .

Exercises 3.1
1. a. Give an example of an algorithm that should not be considered an application of the brute-force approach.
b. Give an example of a problem that cannot be solved by a brute-force algorithm. 2. a. What is the efficiency of the brute-force algorithm for computing an as a function of n? As a function of the number of bits in the binary representation of n?
b. If you are to compute an mod m where a > 1 and n is a large positive integer, how would you circumvent the problem of a very large magnitude of an ?
3. For each of the algorithms in Problems 4, 5, and 6 of Exercises 2.3, tell whether or not the algorithm is based on the brute-force approach.
4. a. Design a brute-force algorithm for computing the value of a polynomial p(x) = an xn + an−1 xn−1 + ... + a1 x + a0 at a given point x0 and determine its worst-case efficiency class.
b. If the algorithm you designed is in Θ(n2 ), design a linear algorithm for this problem.
c. Is it possible to design an algorithm with a better than linear efficiency for this problem?
5. Sort the list E, X, A, M, P, L, E in alphabetical order by selection sort.
6. Is selection sort stable? (The definition of a stable sorting algorithm was given in Section 1.3.)
7. Is it possible to implement selection sort for linked lists with the same
Θ(n2 ) efficiency as the array version?
8. Sort the list E, X, A, M, P, L, E in alphabetical order by bubble sort.
9. a. Prove that if bubble sort makes no exchanges on its pass through a list, the list is sorted and the algorithm can be stopped.
1

b. Write a pseudocode of the method that incorporates this improvement.
c. Prove that the worst-case efficiency of the improved version is

You May Also Find These Documents Helpful

  • Satisfactory Essays

    On the basis of the following data for Seller Co. for 2008 and the preceding year ended December 31, 2007, prepare a statement of cash flows. Use the indirect method of reporting cash flows from operating activities. Assume that equipment costing $125,000 was purchased for cash and equipment costing $85,000 with accumulated depreciation of $65,000 was sold for $15,000; that the stock was issued for cash; and that the only entries in the retained earnings account were net income of $51,000 and cash dividends declared of $13,000.…

    • 618 Words
    • 6 Pages
    Satisfactory Essays
  • Satisfactory Essays

    a. Solve parts a and b of problem 103 on page 605 and problem 104 on page 606 of Elementary and Intermediate Algebra .…

    • 548 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    b. Include the function written in Exercise 2a in a working program. Make sure your function…

    • 720 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    b. Ch. 2: RQs 1 – 9, 10, 11 and Problems #1 and 2 (include all attributes).…

    • 2322 Words
    • 10 Pages
    Satisfactory Essays
  • Satisfactory Essays

    | According to your reading in FM 5-0, which one of the following is NOT considered a characteristic/behavior of a leader that is a critical thinker? Answer…

    • 734 Words
    • 3 Pages
    Satisfactory Essays
  • Satisfactory Essays

    6. Press STAT which option will sort data in ascending order? What do you think will happen if option 3 is selected? __________________________________…

    • 641 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    Assignment BBAC 101 2 1

    • 722 Words
    • 9 Pages

    This assignment must be submitted online (Turn-it-in) and also in person (a hard copy). It is no longer possible to submit assessment via email (absolutely not acceptable).…

    • 722 Words
    • 9 Pages
    Good Essays
  • Satisfactory Essays

    CJA 374 Week 5 DQs

    • 423 Words
    • 3 Pages

    This work of CJA 374 Week 5 Discussion Questions shows the solutions to the following problems:…

    • 423 Words
    • 3 Pages
    Satisfactory Essays
  • Powerful Essays

    Ptlls Assignment 1 Level 4

    • 2424 Words
    • 10 Pages

    Working as an operations trainer for Airline Services Ltd (ASL), my job is to travel around to many of the UK’s major airports to deliver training and development of front line staff. Training within the aviation industry is of critical importance as many of our staff work in a hazardous environment involving live aircraft and heavy machinery. A great deal of the training I deliver is directly related to ASL company operating procedures to ensure that all staff are working to company standards and ensuring their safety and the safety of others. ASL provide a number of services to various major airlines, which range from the very basic (cleaning) to more complex services such as de-icing. The range of complexity in the services that ASL provides, results in a wide range of learner levels, where some staff may find aspects difficult to understand. Within ASL’s workforce there is a great deal of diversity in terms of education level, work experience, age, race, gender and previous knowledge from previous jobs that can make training challenging. It is of huge importance that when delivering training, it is specific to the task that the learner is expected to carry out on a daily basis and at the same time gives them the opportunity to question and discuss aspects of their role openly and not to feel in doubt, criticised or intimidated when voicing their opinion. It is crucial that all staff comply with ASL’s company values of: Quality, Reliability & Performance, (ASL website ref) especially myself during the delivery of training as these values filter throughout the entire company and can make all the difference when securing customer contracts and meeting expectations.…

    • 2424 Words
    • 10 Pages
    Powerful Essays
  • Satisfactory Essays

    Simpsons

    • 982 Words
    • 4 Pages

    1. Rearrange these numbers in order of size, starting with the smallest and ending with the largest, in both digit form and in words. • • • • 5 078 231 5 807 123 587 321 5 780 321 Number (in Digits)…

    • 982 Words
    • 4 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Medalla4C Ch2 Exer

    • 173 Words
    • 2 Pages

    3 Quick Sort Agents_Metaphor on the Comm_2002 column in ascending order, then in descending order.…

    • 173 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Young men fight and die for their country in every single war, and Vietnam was no different. However, U.S. forces during the Vietnam War, on average, were the youngest in American history. In previous wars many men in their twenties were drafted for military service, and men of that age and older would often volunteer. During the Vietnam War most of the volunteers and draftees were teenagers; the average age was nineteen. In World War II, the average American soldier was twenty-six years old. At the age of eighteen young men could join or be drafted into the army. At seventeen, with the consent of a guardian, boys could enlist in the Marine Corps. At the beginning of the war, hundreds of seventeen year old marines served in Vietnam. However, in November 1965, the Pentagon ordered that all American troops must be eighteen before being deployed in the war zone. The soldiers sent off to Vietnam can be divided into three categories: one-third draftees, one-third draft-motivated volunteers, and one-third true volunteers. As the war continued, the number of volunteers steadily declined. Almost half of the army troops were draftees, and in the combat units the portion was commonly as high as two-thirds; late in the war it was even higher. These were the majority of the people dying in the war, from 1966 to 1969, the percentage of draftees who died in the war doubled from 21 to 40. Those who could avoid the draft legally through deferments were the upper class, while those in the middle and lower class who didn’t want to fight in the war had to figure out ways to avoid the draft. Because the draft threatened middle and lower class males between the ages of 18 to 35, they united together through protests to oppose the draft by burning draft cards.…

    • 1097 Words
    • 5 Pages
    Powerful Essays
  • Good Essays

    *Note: All asterisked Questions, Exercises, and Problems relate to material contained in the appendix*to the chapter.…

    • 7223 Words
    • 29 Pages
    Good Essays
  • Satisfactory Essays

    On Course Journal 12

    • 441 Words
    • 2 Pages

    3. Write each action from your list in Step 1 in the appropriate quadrant on your chart.…

    • 441 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    The prison system is just as corrupt as the prisoners inside them. We live in a world where it is deemed acceptable to punish a criminal by taking away their humanity, and only release them when they find it themselves. It is apparent that the methods of handling prisoners and their sentences is costly and not effective. The recidivism rate in the United States prison and detention facilities are incredibly high, much higher than their Scandinavian counterpart. Recidivism “refers to a person's relapse into criminal behavior, often after the person receives sanctions or undergoes intervention for a previous crime.” (National Institute of Justice) According to the National Institute of Justice, “within three years of release, about two-thirds of released prisoners were rearrested; and within five years of release, about three-quarters of released prisoners were rearrested.” (National Institute of Justice) Unfortunately the statistics are only the tip of the iceberg in the severely flawed and failing prison. We must reform the flawed prison system, only than can we correct the criminal way of life.…

    • 294 Words
    • 2 Pages
    Good Essays

Related Topics