Big Chemical Encyclopedia

Chemical substances, components, reactions, process design ...

Articles Figures Tables About

Insertion-sort algorithm

Example 5-11 The following logic algorithm for sort L,S) has been designed with L as induction parameter, following the Intrinsic Heuristic. The result is the Insertion-Sort algorithm. [Pg.70]

This is the so-called Insertion-Sort algorithm. It is non-trivial in the sense that a new predicate, here for convenience called insertl3, needs to be invented from scratch. Moreover, this sub-synthesis needs to be done in totally automatic mode, as the specifier is not supposed to be able to answer questions about such invented predicates. [Pg.209]

In the preceding section, we developed two algorithms for sorting. Which of these should we use The answer to this depends on the relative performance of the two algorithms. The performance of an algorithm is measured in terms of the space and time needed by the algorithm to complete its task. Let us concentrate on time here. In order to answer the question How much time does insertion sort take we must ask ourselves the following ... [Pg.48]

Also, we mentioned that step (1) of a divide-and-conquer strategy consists of dividing a problem into sub-problems, unless it can be trivially solved . We have here taken the option that the unless it can be trivially solved clause is applicable iff a minimal form of the domain of the induction parameter is attained. An alternative interpretation would be that the clause may be applicable in even other cases. A good illustration of this point of view is Sedgewick s enhancement of Hoare s original Quick-Sort algorithm it switches to Insertion-Sort once the unsorted list has less than, say, 15 elements. Such sophisticated design-choices are beyond the scope of our study. [Pg.109]

The omega notation is used to provide a lower bound, while the theta notation is used when the obtained bound is both a lower and an upper bound. The little oh notation is a very precise notation that does not find much use in the asymptotic analysis of algorithms. With these additional notations available, the solution to the recurrence for insertion and merge sort are, respectively, 0(n ) and 0(n logn). The definitions of O, 2, 0, and o are easily extended to include functions of more than one variable. For example, f(n,m) = 0(g(n, m)) if there exist positive constants c, uq and mo such that /(n, m) < cg(n, m) for all n> no and all m > mo. As in the case of the big oh notation, there are several functions g(n) for which /(n) = Q(g(n)). The g(n) is only a lower bound on f(n). The 0 notation is more precise that both the big oh and omega notations. The following theorem obtains a very useful result about the order of f(n) when f(n) is a polynomial in n. [Pg.50]


See other pages where Insertion-sort algorithm is mentioned: [Pg.109]    [Pg.213]    [Pg.213]    [Pg.214]    [Pg.109]    [Pg.213]    [Pg.213]    [Pg.214]    [Pg.127]    [Pg.47]    [Pg.47]    [Pg.49]    [Pg.49]    [Pg.51]    [Pg.51]    [Pg.52]    [Pg.103]    [Pg.40]    [Pg.70]    [Pg.104]    [Pg.149]    [Pg.24]    [Pg.7]    [Pg.86]   
See also in sourсe #XX -- [ Pg.40 , Pg.70 , Pg.109 , Pg.149 , Pg.209 , Pg.213 ]




SEARCH



Sort

© 2024 chempedia.info