heapp

Crates.ioheapp
lib.rsheapp
version0.1.0
sourcesrc
created_at2021-08-03 13:28:34.640806
updated_at2021-08-03 13:28:34.640806
descriptionSome heap operations on slice
homepage
repositoryhttps://github.com/Jamyw7g/heapp
max_upload_size
id430944
size40,567
(Jamyw7g)

documentation

https://docs.rs/heapp

README

heapp

Some heap operations on slice

Example

The following examples show a quick example of some of the very basic functionality of heapp.

use heapp::*;

fn main() {
  let mut heap = vec![4, 7, 8, 3, 4, 90, 78, 67, 90];
  heapify(&mut heap);	// build a heap
  heap.push(32);
  heap_push(&mut heap); // push an element into the heap
  heap_pop(&mut heap); // pop an element from the heap
  let ele = heap.pop().unwrap();
  
  heap_sort(&mut heap); // same as heap.sort(), but using heap sort algorithm
  
  let res = n_smallest(&mut heap, 3); // res == [3, 4, 4]
}
Commit count: 4

cargo fmt