Implementation of sets using sorted lists

License: Freeware
Date Added: 18 May, 2013
Category: Scripts / Others
Author: activestate.com

This script implements set operations using sorted lists as the underlying data structure. Advantages: - Space savings -- lists are much more compact than a dictionary based implementation.


Advertisements



 

This script implements set operations using sorted lists as the underlying data structure. Advantages: - Space savings -- lists are much more compact than a dictionary based implementation. - Flexibility -- elements do not need to be hashable, only __cmp__ is required. - Fast operations depending on the underlying data patterns. - Non-overlapping sets get united, intersected, or differenced with only log(N) element comparisons.Results are built using fast-slicing. - Algorithms are designed to minimize the number of compares which can be expensive. - Natural support for sets of sets. No special accomodation needs to be made to use a set or dict as a set member, but users need to be careful to not mutate a member of a set since that may breaks its sort invariant. Disadvantages:  -  Set construction uses list.sort() with potentially N log(N) comparisons. - Membership testing and element addition use log(N) comparisons. Element addition uses list.insert() with takes O(N) time.


Operating Systems:  Python, Windows, Linux, BSD, Solaris, Mac OS


Implementation of sets using sorted lists Related Downloads
 
Download Recursive sorting 1.0

Recursive sorting 1.0  This script allows you to sort recursively nested lists if iterable is a mutable sequence type.

Download Fifo as single linked lists 1.4

Fifo as single linked lists 1.4  Fifo mean "First In First Out". This script  creates a container, which only allows element insertion and removal and where the first element inserted is the first element removed.

Download Lazy streams using generators 1.0

Lazy streams using generators 1.0  This class allows you to use generators as more list-like streams. The chief advantage is that it is impossible to iterate through a generator more than once, while a stream can be re-used like a list.

Download Getting th permutation of a sequence 1.1

Getting th permutation of a sequence 1.1  This script contains a function that given a sequence and a number n as parameters, returns the th permutation of the sequence (always as a list).

Download Merge sorted sequences 1.1

Merge sorted sequences 1.1  The usual approach to merging is to loop through both sequences taking the smallest from each until they are both exhausted. Python's "timsort" function detects order in underlying sequences and will run a C speed merge on the data.

Download Merging two sorted iterators 1.1

Merging two sorted iterators 1.1  Merging two sorted iterators script provides a mergeiter() function that can merge two iterators into a single iterator. It uses generators, and guarantees constant memory use.

Download Merging sorted iterables 1.2

Merging sorted iterables 1.2  This script helps you to merge sorted iterables, preserving ordering,without consuming iterables (and computing time) unnecessarily.

Download Iterator Merge 1.2

Iterator Merge 1.2  This script merges multiple sorted inputs into a single sorted output.

Download LavaMind Study Center for SAT, PSAT, ACT 1.0

LavaMind Study Center for SAT, PSAT, ACT 1.0  LavaMind has designed a program that will help you improve your SAT I, SAT II, PSAT, ACT scores. The Study Center is packed with tutorials and test-taking advice.

Others Popular Downloads
 
Download mvnForum .2GA 1.0

mvnForum .2GA 1.0  mvnForum is an open source, powerful, easy to use, easy to setup bulletin board (forum) built on the Java J2EE technology (Jsp/Servlet). mvnForum is compatible with any Servlet Containers which supports Jsp 1.2 and Servlet 2.3.

Download Aardvark Topsites PHP 5.2.0

Aardvark Topsites PHP 5.2.0  Aardvark Topsites PHP has a ton of features. I'm not going to bore you with all the inane details, but here is a list of the main features. - Members ranks can be shown on their button.

Download Guestbook class 1.0

Guestbook class 1.0  This class is meant to manage a guest book storing its records either in XML files database or in a SQL database. Currently it supports only MySQL databases.

Download lilURL 0.1.1

lilURL 0.1.1  lilURL is a simple PHP/MySQL script for generating shorter URLs. It's similar to TinyURL, Shorl, MakeAShorterLink, etc, but you can run it on your own server ((which is pretty much the same thing as TightURL).

Download MOC Designs PHP News 1.1

MOC Designs PHP News 1.1  MOC Designs PHP News is a PHP-SQL powered, dynamic, news editor and displayer. Adding news on your website is done through a web-page form, saving you the time of editing your news page and then uploading the news page again.

Download Php Board Script 6.4.3

Php Board Script 6.4.3  Php Board Script allows you to create a simple discussion forum. It is made in Php, without My SQL, which on each server or Webspace is installed in well 5 minutes.

Download CMS Mini 0.2.2

CMS Mini 0.2.2  CMS Mini is a very small PHP application for manage content for small web sites. Not intended for a cooperative group of editors and rewiers: simply one editor can insert new contents, immediatly pubblished on web: "one task, one click".

Download m-phorum 0.3

m-phorum 0.3  m-phorum is a new small phorum, using PHP with one mysql database backend. Tested on php 4.3, apache 1.3.27 & mysql 3.23.52. It is simple and fast.

Download PDF::Reader 1.0

PDF::Reader 1.0  The PDF::Reader library implements a PDF parser conforming as much as possible to the PDF specification from Adobe.

Submit Reviews for Implementation of sets using sorted lists
- required fields