Priority dictionary

Category: Python - Education

This data structure acts almost like a dictionary, with two modifications: First, D.smallest() returns the value x minimizing D[x]. For this to work correctly, all values D[x] stored in the dictionary must be comparable. Second, iterating "for x in D" finds and removes the items from D in sorted order. Each item is not removed until the next item is requested, so D[x] will still return a useful value until the next iteration of the for-loop. Date: 25 May, 2012


Data Structure - Dictionary Structure - Dictionary Script - Data - Structure - Dictionary

Homepage: http://code.activestate.com/

Developer: code.activestate.com

License: Freeware

Operating System: All

Add a Comment

all are required fields

     
What do you think of this resource?

Select Your Rate:

Votes:0

 

Related Scripts Download

This script implements the Union Find data structure and algorithm.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script is a pure python drop in replacement for collections.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This structure is a kind of dictionary which allows you to map data intervals to values.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


Quick and easy FIFO queue class is an easy First-In-First-Out queue class based on Python's List data structure.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


A ring buffer is a buffer with a fixed size.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


The str() function in the standard library behaves in a slightly weird way when applied against lists: on each element of the list, the repr() is appended.

developer Developer: code.activestate.com
license License: Artistic License, GNU General Public License (GPL)
operating systems Operating System: Windows, Linux, Mac OS, BSD, Solaris


Generic Tree Data Structure for Ruby is a simple to use general purpose Tree data structure implementation in Ruby.

developer Developer: files.rubyforge.vm.bytemark.co.uk
license License: Freeware
operating systems Operating System: Windows, Linux, Mac OS, BSD, Solaris


Fisher Yates Shuffle script randomly shuffles elements of an array.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All


This script is a simple oneliner to built a dictionary from a list.

developer Developer: code.activestate.com
license License: Freeware
operating systems Operating System: All