Experimental evaluation of Navigation piles

Slides:



Advertisements
Similar presentations
Heaps1 Part-D2 Heaps Heaps2 Recall Priority Queue ADT (§ 7.1.3) A priority queue stores a collection of entries Each entry is a pair (key, value)
Advertisements

1 HeapSort CS 3358 Data Structures. 2 Heapsort: Basic Idea Problem: Arrange an array of items into sorted order. 1) Transform the array of items into.
CS 104 Introduction to Computer Science and Graphics Problems Data Structure & Algorithms (4) Data Structures 11/18/2008 Yang Song.
Nick Harvey & Kevin Zatloukal
Chapter 12 C Data Structures Acknowledgment The notes are adapted from those provided by Deitel & Associates, Inc. and Pearson Education Inc.
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
PQ, binary heaps G.Kamberova, Algorithms Priority Queue ADT Binary Heaps Gerda Kamberova Department of Computer Science Hofstra University.
Binary Trees Chapter 6.
CSCE 3110 Data Structures & Algorithm Analysis Binary Search Trees Reading: Chap. 4 (4.3) Weiss.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Templatized Tree.
1 Trees Tree nomenclature Implementation strategies Traversals –Depth-first –Breadth-first Implementing binary search trees.
Chapter 19: Binary Trees. Objectives In this chapter, you will: – Learn about binary trees – Explore various binary tree traversal algorithms – Organize.
1 Trees A tree is a data structure used to represent different kinds of data and help solve a number of algorithmic problems Game trees (i.e., chess ),
Chapter 6 Binary Trees. 6.1 Trees, Binary Trees, and Binary Search Trees Linked lists usually are more flexible than arrays, but it is difficult to use.
Data Structure & Algorithm II.  Delete-min  Building a heap in O(n) time  Heap Sort.
Chapter 21 Binary Heap.
Chapter 11 Heap. Overview ● The heap is a special type of binary tree. ● It may be used either as a priority queue or as a tool for sorting.
Chapter 9 (modified) Abstract Data Types and Algorithms Nell Dale John Lewis.
B + -Trees Same structure as B-trees. Dictionary pairs are in leaves only. Leaves form a doubly-linked list. Remaining nodes have following structure:
„Policy-Based Benchmarking of Weak Heaps and Their Relatives“ Asger Bruun*, Stefan Edelkamp, Jyrki Katajainen*, Jens Rasmussen* *University of Copenhagen.
An experimental study of priority queues By Claus Jensen University of Copenhagen.
Priority Queue. Priority Queues Queue (FIFO). Priority queue. Deletion from a priority queue is determined by the element priority. Two kinds of priority.
Data Structure II So Pak Yeung Outline Review  Array  Sorted Array  Linked List Binary Search Tree Heap Hash Table.
Queues, Stacks and Heaps. Queue List structure using the FIFO process Nodes are removed form the front and added to the back ABDC FrontBack.
Main Index Contents 11 Main Index Contents Complete Binary Tree Example Complete Binary Tree Example Maximum and Minimum Heaps Example Maximum and Minimum.
Heaps © 2010 Goodrich, Tamassia. Heaps2 Priority Queue ADT  A priority queue (PQ) stores a collection of entries  Typically, an entry is a.
Navigation Piles with Applications to Sorting, Priority Queues, and Priority Deques Jyrki Katajainen and Fabio Vitale Department of Computing, University.
Sorting With Priority Queue In-place Extra O(N) space
Data Structure By Amee Trivedi.
Chapter 12 – Data Structures
CSCE 3110 Data Structures & Algorithm Analysis
Tries 07/28/16 11:04 Text Compression
Tries 5/27/2018 3:08 AM Tries Tries.
Recursive Objects (Part 4)
Splay Trees Binary search trees.
Priority Queues © 2010 Goodrich, Tamassia Priority Queues 1
Heaps © 2010 Goodrich, Tamassia Heaps Heaps
Heaps 9/13/2018 3:17 PM Heaps Heaps.
Priority Queues Sections 6.1 to 6.5.
Tree data structure.
Splay Trees Binary search trees.
ADT Heap data structure
8.1 Tree Terminology and Applications
Interval Heaps Complete binary tree.
Description Given a linear collection of items x1, x2, x3,….,xn
original list {67, 33,49, 21, 25, 94} pass { } {67 94}
Heaps and Priority Queues
Trees and Binary Trees.
Chapter 8 – Binary Search Tree
Priority Queues and Heaps
Priority Queue & Heap CSCI 3110 Nan Chen.
Heapsort Heap & Priority Queue.
Tree data structure.
Data Structures and Algorithms
Heaps and the Heapsort Heaps and priority queues
Tree Representation Heap.
CS Data Structures Chapter 17 Heaps Mehmet H Gunes
Heaps and Priority Queues
© 2013 Goodrich, Tamassia, Goldwasser
Heaps 12/4/2018 5:27 AM Heaps /4/2018 5:27 AM Heaps.
Ch. 8 Priority Queues And Heaps
Heaps and Priority Queues
Binary Tree Traversals
CMSC 202 Trees.
Binary Search Trees.
Heaps and Priority Queues
OPIM 915 Fall 2010 Data Structures 23-38,
The Heap ADT A heap is a complete binary tree where each node’s datum is greater than or equal to the data of all of the nodes in the left and right.
EE 312 Software Design and Implementation I
Heaps 9/29/2019 5:43 PM Heaps Heaps.
Presentation transcript:

Experimental evaluation of Navigation piles By Claus Jensen University of Copenhagen

Based on the article NAVIGATION PILES WITH APPLICATIONS TO SORTING, PRIORITY QUEUES, AND PRIORITY DEQUES By JYRKI KATAJAINEN and FABIO VITALE

Structure of static navigation piles Shape It is a left-complete binary tree of size N, where N ≥ n (# of elements stored). Leaf The leaves are used to store the elements. The first n leaves store one element each, the rest are empty.

Structure of static navigation piles Branch: A branch (node) contains the index of the leaf storing the top element among the group of elements attached to the leaves in the subtree rooted by the branch.

Structure of static navigation piles Representation: The elements are stored in sequence A[0..n). The branches are stored in sequence B[0..N).

Structure of static navigation piles

Algorithms Make Construction of a navigation pile is done by visiting the branches in a bottom-up manner and computing its index using the indices available at the children. n-1 element comparisons n element moves O(n) instructions

Algorithms Push A new element is inserted into the first empty leaf, followed by an update of the branches from the leaf to the root. A binary search strategy can be used in the update. loglog n + O(1) element comparisons 1 element move O(log n) instructions

Algorithms Top A reference to the top element stored at the root is returned. O(1) instructions

Algorithms Pop The top element is erased and the indices are updated. The update is done in three different ways depending on circumstances inside the navigation pile. Ceiling of log n element comparisons 1 or 2 element moves O(log n) instructions

Algorithms (Pop) l: element index of the last leaf. m: element index of the top element. i: Branch index of the first ancestor of the last leaf which has two children. j: The element index referred to by the first child of i. k: The element index referred to by i.

Algorithms (Pop) Case 1: m = l The top element is erased and the index values on the path from the new last leaf to the root are updated.

Algorithms (Pop) Case 2: m ≠ l and k ≠ l A[m] ← A[l] and the element stored at the last leaf is erased. The content of the branches on the path from the leaf corresponding to the position m up to the root are updated.

Algorithms (Pop) Case 3: m ≠ l and k = l A[m] ← A[j], A[j] ← A[l] and the element stored at the last leaf is erased. The content of the branches on the path [i, root] are updated with a reference to j, if they earlier referred to the last leaf. The content of the branches on the path from the leaf corresponding to the position m up to the root are updated.

Programs The navigation pile data structure was implemented in three different versions. The first version used an STL vector to store the indices at the branches. The second version used pointers instead of indices in an attempt to optimize the performance.

Programs The third version packed the offsets as suggested in the original article. Offsets indicate the leaf position of the top element within the subtree rooted by the branch. The use of offsets instead of indices reduces the space required to 2N bits, where N is the capacity of the navigation pile. All versions were repeatedly improved based on profiling results.

Benchmarks Environment A Intel computer: CPU: Pentium 3 (1GHz) Main Memory: RAM 384 MB Cache level 2: 246 KB Operation system: Debian Sarge C++ Compiler: g++ 3.2

Benchmarks Environment B AMD computer: CPU: Athlon XP 2100+ (1.73 GHz) Main Memory: RAM 256 MB Cache level 2: 256 KB Operation system: Red Hat 8.0 C++ Compiler: g++ 3.2

Benchmarks (input data) cheap move expensive move cheap comparison unsigned int big int ln comparison (int, big int)

Benchmarks Navigation piles were compared to SGI STL’s binary heaps. The benchmarks performed a construction operation followed by a series of pops. The CPH STL benchmark tool was use in the production of the benchmarks.

Benchmarks (Intel P3)

Benchmarks (AMD Athlon)

Benchmarks (Intel P3)

Benchmarks (AMD Athlon)

Benchmarks (Intel P3)

Benchmarks (AMD Athlon)

Benchmarks (Intel P3)

Benchmarks (AMD Athlon)

Questions