File tree Expand file tree Collapse file tree 2 files changed +11
-5
lines changed
Expand file tree Collapse file tree 2 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "examples/point_add_range_sum.rs" : " 2024-05-16 05:41:44 -0600" ,
3+ "examples/shortest_path.rs" : " 2024-05-16 05:41:44 -0600" ,
4+ "examples/staticrmq.rs" : " 2024-05-16 05:41:44 -0600" ,
5+ "examples/unionfind.rs" : " 2024-05-16 05:41:44 -0600"
6+ }
Original file line number Diff line number Diff line change @@ -7,11 +7,11 @@ impl<T: Ord + Copy> RMQ<T> {
77 let mut t = vec ! [ a. clone( ) ; 1 ] ;
88 let mut i = 0 ;
99 while ( 2 << i) <= a. len ( ) {
10- t. push ( Vec :: with_capacity ( t [ i ] . len ( ) - ( 1 << i ) ) ) ;
11- for j in 0 ..t[ i] . len ( ) - ( 1 << i) {
12- let x = op ( t[ i] [ j] , t[ i] [ j + ( 1 << i) ] ) ;
13- t [ i + 1 ] . push ( x ) ;
14- }
10+ t. push (
11+ ( 0 ..t[ i] . len ( ) - ( 1 << i) )
12+ . map ( |j| op ( t[ i] [ j] , t[ i] [ j + ( 1 << i) ] ) )
13+ . collect ( ) ,
14+ ) ;
1515 i += 1 ;
1616 }
1717 Self { t, op }
You can’t perform that action at this time.
0 commit comments