Skip to content

Commit 7b0dbd6

Browse files
committed
GitHub Badges
1 parent f7e1f71 commit 7b0dbd6

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
# Contest Algorithms in Rust
22

3+
[![Crates.io Version](https://img.shields.io/crates/v/contest-algorithms.svg)](https://crates.io/crates/contest-algorithms)
4+
[![Documentation](https://docs.rs/contest-algorithms/badge.svg)](https://docs.rs/contest-algorithms)
5+
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bevyengine/bevy/blob/master/LICENSE)
6+
[![Crates.io Downloads](https://img.shields.io/crates/d/contest-algorithms.svg)](https://crates.io/crates/contest-algorithms)
37
[![Build Status](https://travis-ci.org/EbTech/rust-algorithms.svg?branch=master)](https://travis-ci.org/EbTech/rust-algorithms)
4-
[![Latest Version](https://img.shields.io/crates/v/contest-algorithms.svg)](https://crates.io/crates/contest-algorithms)
8+
[![Gitter](https://badges.gitter.im/rust-algos/community.svg)](https://gitter.im/rust-algos/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
59

610
A collection of classic data structures and algorithms, emphasizing usability, beauty and clarity over full generality. As such, this should be viewed not as a blackbox *library*, but as a whitebox *cookbook* demonstrating the design and implementation of algorithms. I hope it will be useful to students and educators, as well as fans of algorithmic programming contests.
711

src/range_query/dynamic_arq.rs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,10 @@ impl<T: ArqSpec> DynamicArq<T> {
6868
/// Builds a tree whose leaves are set to a given non-empty slice.
6969
pub fn build_from_slice(&mut self, init_val: &[T::S]) -> ArqView {
7070
if init_val.len() == 1 {
71-
let mut root = DynamicArqNode::default();
72-
root.val = init_val[0].clone();
71+
let root = DynamicArqNode {
72+
val: init_val[0].clone(),
73+
..Default::default()
74+
};
7375
self.nodes.push(root);
7476
(self.nodes.len() - 1, 1)
7577
} else {
@@ -85,8 +87,10 @@ impl<T: ArqSpec> DynamicArq<T> {
8587
pub fn merge_equal_sized(&mut self, (lp, ls): ArqView, (rp, rs): ArqView) -> ArqView {
8688
assert!(ls == rs || ls + 1 == rs);
8789
let p = self.nodes.len();
88-
let mut root = DynamicArqNode::default();
89-
root.down = (lp, rp);
90+
let root = DynamicArqNode {
91+
down: (lp, rp),
92+
..Default::default()
93+
};
9094
self.nodes.push(root);
9195
self.pull(p);
9296
(p, ls + rs)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy