Preview

Heap Sorting

Satisfactory Essays
Open Document
Open Document
2119 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Heap Sorting
CEng 315 - Week 4b
Dept. of Computer Engineering
Middle East Technical Univ.
Ankara - TURKEY

Anaysis of Algorihms, Fall 2012

CEng 315

1

Recurrences (cont.)

• Inhomogeneous Recurrences: We now consider recurrences of a slightly more general form: a0tn + a1tn-1 + … + aktn-k = bnp(n)

(2)

• The left hand side is the same as (1), but on the right hand side we have bnp(n), where b is a constant and p(n) is a polynomial in n of degree d.

Anaysis of Algorihms, Fall 2012

CEng 315

2

Recurrences (cont.)
Example: Solve the following recurrence: tn - 2tn-1 = 3n.
In this case b =3 and p(n) = 1, a polynomial of degree d=0.
A little manipulation allows us to reduce this example to the form (1).
To see this, we first multiply the recurrence by 3, obtaining
3tn - 6tn-1 = 3n+1.
If we replace n by n+1 in the original recurrence, we get tn+1 - 2tn = 3n+1.
Finally, subtracting these two equations, we have tn+1 - 5tn + 6tn-1 = 0, which can be solved by the above method.
The characteristic equation is x2 - 5x + 6 = 0. That is, (x-2)(x-3) = 0.

• Intuitively we can see that the factor (x-2) corresponds to the left-hand side of the original recurrence, whereas the factor (x-3) has appeared as a result of our manipulation to get rid of the right-hand side.
Anaysis of Algorihms, Fall 2012

CEng 315

3

Recurrences (cont.)
• Generalizing this approach, to solve (2): a0tn + a1tn-1 + … + aktn-k = bnp(n) (2) we can show that it is sufficient to take the following characteristic equation:
(a0xk+ a1xk-1 +…+ ak )(x-b)d+1 = 0,

where d is the degree of polynomial p(n)
• Once this equation is obtained, proceed as in the homogeneous case.

Anaysis of Algorihms, Fall 2012

CEng 315

4

Recurrences (cont.)
Example: The number of movements of a ring required in the Towers of
Hanoi problem is given by the following recurrence relation: tn = 2tn-1 + 1, n  1, subject to t0 = 0.
The recurrence can be written tn - 2tn-1

You May Also Find These Documents Helpful

  • Satisfactory Essays

    (c) Square the coefficient of the original x term and add it to both sides of the equation.…

    • 342 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Mat 540 Quiz 3

    • 567 Words
    • 3 Pages

    Math 1 Quiz # 3 Third Quarter Adding and Subtracting Polynomials July 28, 2011 Name:Von Clifford N. Opelanio Score:___________________ Yr. & Section:7-St.Therese Parent’s Signature:______________ I. Add the following polynomials: 1-2. 3-4.…

    • 567 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    4.02 Chemistry Notes

    • 782 Words
    • 4 Pages

    2. Whenever you add a coefficient in front of a formula, remember that it affects the number of each atom in that formula. Check how this new coefficient affects each element in the equation before you add the next coefficient.…

    • 782 Words
    • 4 Pages
    Good Essays
  • Better Essays

    Now that we know how each of the terms operate within the equation, you may wonder…

    • 659 Words
    • 3 Pages
    Better Essays
  • Good Essays

    Algorithm Scheduling

    • 2087 Words
    • 9 Pages

    Organize the execution schedule of these tasks using simple scheduling (FIFO). Use timing diagram to show your solution.…

    • 2087 Words
    • 9 Pages
    Good Essays
  • Better Essays

    Parallel Processing

    • 1221 Words
    • 5 Pages

    Visual search, the task of finding a target among distractors, is a common task in our daily lives. Whether we are searching for the remote control among a clutter of objects on table, a face in the crowd at the local bus stop, or a meal listing on the menu at the fast-food restaurant, we rely on the mechanism of visual search and attention each and every day. The ease of search depends primarily on how distinguishable the target of search is from the background. Often times, we depend on attention to facilitate this search for our given target. Attention can help one find an object by, say, focusing on the location of the target. There are two modes of attention in which people typically rely on: parallel processing and serial processing. Parallel processing involves investigating and analyzing a multitude of objects on many different kinds of analysis all at the same time. In contrast, serial processing involves investigating each object one at a time.…

    • 1221 Words
    • 5 Pages
    Better Essays
  • Powerful Essays

    approaches are computationally expensive. Hence the running time becomes unacceptably long. It is estimated that over 90% of the tuning…

    • 1564 Words
    • 7 Pages
    Powerful Essays
  • Powerful Essays

    Gaurang Khetan Graduate Student, Department of Computer Science, University of Southern California, Los Angeles, CA. gkhetan@usc.edu December 16, 2002…

    • 4563 Words
    • 19 Pages
    Powerful Essays
  • Better Essays

    Master Theorem

    • 5125 Words
    • 21 Pages

    In the last section, we saw three different kinds of behavior for recurrences of the form aT (n/2) + n if n > 1 d if n = 1.…

    • 5125 Words
    • 21 Pages
    Better Essays
  • Satisfactory Essays

    Hashing

    • 313 Words
    • 2 Pages

    The features of this book are conducive to independent learning. From beginning to end, the…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Memory Management

    • 341 Words
    • 2 Pages

    In conclusion, the two systems have a lot in common and few differences technically speaking. Although, they were developed in a…

    • 341 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Data Structures

    • 312 Words
    • 2 Pages

    There are two types of homework assignments: written assignments and programming assignments. Despite the fact that the problem sets account for only 30% of the grade, they form an important part of the course. You should prepare to spend an average of at least 5 hours on the homework problems each week. Warning: If you do not do substantially the problem sets, then do not expect to pass. You are encouraged to collaborate in study groups on the solution of the homework. However, you must write up solutions on your own. Plagiarism and other antiintellectual behavior will be dealt with severely.…

    • 312 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    The memory management is one of the core components of an operating system which manages the memory hierarchy of Random Access Memory (RAM), and hard disks. The important tasks of the operating systems in managing the memory include: the allocation and de-allocation of memory to the processes, the utilization of the hard disk for implementation of the Virtual Memory. The operating system should effectively use the memory component as it directly impacts the overall efficiency and performance of the computer system (Khetan, 2002).…

    • 670 Words
    • 3 Pages
    Good Essays
  • Better Essays

    Data Process

    • 3969 Words
    • 16 Pages

    All through the different stages in civilization, man has always tried to look for ways to simplify work and to solve problems more efficiently. Many problems involved numbers and quantities, so man started looking for easier ways to count, to add, subtract, multiply and divide. As society has grown in both size and complexity, so have data that are generated by it through time.…

    • 3969 Words
    • 16 Pages
    Better Essays
  • Good Essays

    Memory Management

    • 490 Words
    • 2 Pages

    The memory management process in operating systems proceeds under the requirements that include relocation, protection, sharing, logical organization, and physical organization. Each of these requirements is necessary in order for the operating system to correctly carry out the task of subdivision within the part of the memory where the program is being executed.…

    • 490 Words
    • 2 Pages
    Good Essays