Geometric stable distribution

From formulasearchengine
Revision as of 05:49, 10 December 2013 by en>BeyondNormality (→‎References)
Jump to navigation Jump to search

Template:One source

A Queap Q with k = 6 and n = 9

In computer science, a queap is a priority queue data structure. The data structure allows insertions and deletions of arbitrary elements, as well as retrieval of the highest-priority element. Each deletion takes amortized time logarithmic in the number of items that have been in the structure for a longer time than the removed item. Insertions take constant amortized time.

The data structure consists of a doubly linked list and a 2-4 tree data structure, each modified to keep track of its minimum-priority element. The basic operation of the structure is to keep newly inserted elements in the doubly linked list, until a deletion would remove one of the list items, at which point they are all moved into the 2-4 tree. The 2-4 tree stores its elements in insertion order, rather than the more conventional priority-sorted order.

Both the data structure and its name were devised by John Iacono and Stefan Langerman.[1]

Description

A queap is a priority queue that inserts elements in O(1) amortized time, and removes the minimum element in O(log(k + 2)) if there are k items that have been in the heap for a longer time than the element to be extracted. The queap has a property called the queueish property: the time to search for element x is O(lg q(x)) where q(x) is equal to n − 1 − w(x) and w(x) is the number of distinct items that has been accessed by operations such as searching, inserting, or deleting. q(x) is defined as how many elements have not been accessed since x's last access. Indeed, the queueish property is the complement of the splay tree working set property: the time to search for element x is O(lg w(x)).

A queap can be represented by two data structures: a doubly linked list and a modified version of 2-4 tree. The doubly linked list, L, is used for a series of insert and locate-min operations. The queap keeps a pointer to the minimum element stored in the list. To add element x to list l, the element x is added to the end of the list and a bit variable in element x is set to one. This operation is done to determine if the element is either in the list or in a 2-4 tree.

A 2-4 tree is used when a delete operation occurs. If the item x is already in tree T, the item is removed using the 2-4 tree delete operation. Otherwise, the item x is in list L (done by checking if the bit variable is set). All the elements stored in list L are then added to the 2-4 tree, setting the bit variable of each element to zero. x is then removed from T.

A queap uses only the 2-4 tree structure properties, not a search tree. The modified 2-4 tree structure is as follows. Suppose list L has the following set of elements: . When the deletion operation is invoked, the set of elements stored in L is then added to the leaves of the 2-4 tree in that order, proceeded by a dummy leaf containing an infinite key. Each internal node of T has a pointer , which points to the smallest item in subtree v. Each internal node on path P from the root to has a pointer , which points to the smallest key in . The pointers of each internal node on path P are ignored. The queap has a pointer to , which points to the smallest element in T.

An application of queaps includes a unique set of high priority events and extraction of the highest priority event for processing.

Operations

Let minL be a pointer that points to the minimum element in the doubly linked list L, be the minimum element stored in the 2-4 tree, T, k be the number of elements stored in T, and n be the total number of elements stored in queap Q. The operations are as follows:

New(Q): Initializes a new empty queap.

Initialize an empty doubly linked list L and 2-4 tree T. Set k and n to zero.

Insert(Q, x): Add the element x to queap Q.

Insert the element x in list L. Set the bit in element x to one to demonstrate that the element is in the list L. Update the minL pointer if x is the smallest element in the list. Increment n by 1.

Minimum(Q): Retrieve a pointer to the smallest element from queap Q.

If key(minL) < key(), return minL. Otherwise return .

Delete(Q, x): Remove element x from queap Q.

If the bit of the element x is set to one, the element is stored in list L. Add all the elements from L to T, setting the bit of each element to zero. Each element is added to the parent of the right most child of T using the insert operation of the 2-4 tree. L becomes empty. Update pointers for all the nodes v whose children are new/modified, and repeat the process with the next parent until the parent is equal to the root. Walk from the root to node , and update the values. Set k equal to n.
If the bit of the element x is set to zero, x is a leaf of T. Delete x using the 2-4 tree delete operation. Starting from node x, walk in T to node , updating and pointers. Decrement n and k by 1.

DeleteMin(Q): Delete and return the smallest element from queap Q.

Invoke the Minimum(Q) operation. The operation returns min. Invoke the Delete(Q, min) operation. Return min.

CleanUp(Q): Delete all the elements in list L and tree T.

Starting from the first element in list L, traverse the list, deleting each node.
Starting from the root of the tree T, traverse the tree using the post-order traversal algorithm, deleting each node in the tree.

Analysis

The running time is analyzed using the amortized analysis. The potential function for queap Q will be where .

Insert(Q, x): The cost of the operation is O(1). The size of list L grows by one, the potential increases by some constant c.

Minimum(Q): The operation does not alter the data structure so the amortized cost is equal to its actual cost, O(1).

Delete(Q, x): There are two cases.

Case 1

If x is in tree T, then the amortized cost is not modified. The delete operation is O(1) amortized 2-4 tree. Since x was removed from the tree, and pointers may need updating. At most, there will be updates.

Case 2

If x is in list L, then all the elements from L are inserted in T. This has a cost of of some constant a, amortized over the 2-4 tree. After inserting and updating the and pointers, the total time spent is bounded by . The second operation is to delete x from T, and to walk on the path from x to , correcting and values. The time is spent at most . If , then the amortized cost will be . Delete(Q, x): is the addition of the amortized cost of Minimum(Q) and Delete(Q, x), which is .

Code example

A small java implementation of a queap:

public class Queap
{
        public int n, k;
        public List<Element> l; //Element is a generic data type
        public QueapTree t;    //a 2-4 tree, modified for Queap purpose
        public Element minL;

        private Queap() {
                n = 0;
                k = 0;
                l = new LinkedList<Element>();
                t = new QueapTree();
        }

        public static Queap New() {
                return new Queap();
        }

        public static void Insert(Queap Q, Element x) {
                if (Q.n == 0)
                        Q.minL = x;
                Q.l.add(x);
                x.inList = true;
                if (x.compareTo(Q.minL) < 0)
                        Q.minL = x;
        }

        public static Element Minimum(Queap Q) {
                //t is a 2-4 tree and x0, cv are tree nodes.
                if (Q.minL.compareTo(Q.t.x0.cv.key) < 0)
                        return Q.minL;

                return Q.t.x0.cv.key;
        }

        public static void Delete(Queap Q, QueapNode x) {
                Q.t.deleteLeaf(x);
                --Q.n;
                --Q.k;
        }

        public static void Delete(Queap Q, Element x) {
                QueapNode n;
                if (x.inList) {
                        //set inList of all the elements in the list to false
                        n = Q.t.insertList(Q.l, x);
                        Q.k = Q.n;
                        Delete(Q, n);
                }
                else if ((n = Q.t.x0.cv).key == x)
                        Delete(Q, n);
        }

        public static Element DeleteMin(Queap Q) {
                Element min = Minimum(Q);
                Delete(Q, min);
                return min;
        }
}

See also

References

43 year old Petroleum Engineer Harry from Deep River, usually spends time with hobbies and interests like renting movies, property developers in singapore new condominium and vehicle racing. Constantly enjoys going to destinations like Camino Real de Tierra Adentro.

  1. One of the biggest reasons investing in a Singapore new launch is an effective things is as a result of it is doable to be lent massive quantities of money at very low interest rates that you should utilize to purchase it. Then, if property values continue to go up, then you'll get a really high return on funding (ROI). Simply make sure you purchase one of the higher properties, reminiscent of the ones at Fernvale the Riverbank or any Singapore landed property Get Earnings by means of Renting

    In its statement, the singapore property listing - website link, government claimed that the majority citizens buying their first residence won't be hurt by the new measures. Some concessions can even be prolonged to chose teams of consumers, similar to married couples with a minimum of one Singaporean partner who are purchasing their second property so long as they intend to promote their first residential property. Lower the LTV limit on housing loans granted by monetary establishments regulated by MAS from 70% to 60% for property purchasers who are individuals with a number of outstanding housing loans on the time of the brand new housing purchase. Singapore Property Measures - 30 August 2010 The most popular seek for the number of bedrooms in Singapore is 4, followed by 2 and three. Lush Acres EC @ Sengkang

    Discover out more about real estate funding in the area, together with info on international funding incentives and property possession. Many Singaporeans have been investing in property across the causeway in recent years, attracted by comparatively low prices. However, those who need to exit their investments quickly are likely to face significant challenges when trying to sell their property – and could finally be stuck with a property they can't sell. Career improvement programmes, in-house valuation, auctions and administrative help, venture advertising and marketing, skilled talks and traisning are continuously planned for the sales associates to help them obtain better outcomes for his or her shoppers while at Knight Frank Singapore. No change Present Rules

    Extending the tax exemption would help. The exemption, which may be as a lot as $2 million per family, covers individuals who negotiate a principal reduction on their existing mortgage, sell their house short (i.e., for lower than the excellent loans), or take part in a foreclosure course of. An extension of theexemption would seem like a common-sense means to assist stabilize the housing market, but the political turmoil around the fiscal-cliff negotiations means widespread sense could not win out. Home Minority Chief Nancy Pelosi (D-Calif.) believes that the mortgage relief provision will be on the table during the grand-cut price talks, in response to communications director Nadeam Elshami. Buying or promoting of blue mild bulbs is unlawful.

    A vendor's stamp duty has been launched on industrial property for the primary time, at rates ranging from 5 per cent to 15 per cent. The Authorities might be trying to reassure the market that they aren't in opposition to foreigners and PRs investing in Singapore's property market. They imposed these measures because of extenuating components available in the market." The sale of new dual-key EC models will even be restricted to multi-generational households only. The models have two separate entrances, permitting grandparents, for example, to dwell separately. The vendor's stamp obligation takes effect right this moment and applies to industrial property and plots which might be offered inside three years of the date of buy. JLL named Best Performing Property Brand for second year running

    The data offered is for normal info purposes only and isn't supposed to be personalised investment or monetary advice. Motley Fool Singapore contributor Stanley Lim would not personal shares in any corporations talked about. Singapore private home costs increased by 1.eight% within the fourth quarter of 2012, up from 0.6% within the earlier quarter. Resale prices of government-built HDB residences which are usually bought by Singaporeans, elevated by 2.5%, quarter on quarter, the quickest acquire in five quarters. And industrial property, prices are actually double the levels of three years ago. No withholding tax in the event you sell your property. All your local information regarding vital HDB policies, condominium launches, land growth, commercial property and more

    There are various methods to go about discovering the precise property. Some local newspapers (together with the Straits Instances ) have categorised property sections and many local property brokers have websites. Now there are some specifics to consider when buying a 'new launch' rental. Intended use of the unit Every sale begins with 10 p.c low cost for finish of season sale; changes to 20 % discount storewide; follows by additional reduction of fiftyand ends with last discount of 70 % or extra. Typically there is even a warehouse sale or transferring out sale with huge mark-down of costs for stock clearance. Deborah Regulation from Expat Realtor shares her property market update, plus prime rental residences and houses at the moment available to lease Esparina EC @ Sengkang