Git Product home page Git Product logo

algorithm_order_statistic_tree's Introduction

Red Black Tree with Order Statistic

Using Introduction to Algorithm (CLRS 2nd Edition) Pseudocode to create a Red Black Tree with Order Statistic Feature

Goal of code

Write a program that supports the following operations on order- statistic trees. An order-statistic tree is a red-black tree with size information stored in each node. We maintain a dynamic set of integers in an order-statistic tree. Assume that integers are in the range of [1::9999] and initially tree T is empty.

  • OS-Insert(T; x) returns x if integer x is not already in order-statistic tree T (i.e., x is inserted); 0 otherwise.
  • OS-Delete(T; x) returns x if integer x is in T (i.e., x is deleted); 0 otherwise.
  • OS-Select(T; i) returns the i-th smallest integer in T if the number of integers in T is >= i; 0 otherwise.
  • OS-Rank(T; x) returns the rank of x among the integers in T if x is in T; 0 otherwise.

An input file contains a sequence of operations. In the input file OS-Insert(T; 17) is denoted by I 17, OS-Delete(T; 8) by D 8, OS-Select(T; 5) by S 5, and OS-Rank(T; 9) by R 9. Put a space between two operations.

algorithm_order_statistic_tree's People

Contributors

philgookang avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.