aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
This commit is contained in:
parent
965bb36b0b
commit
a475e4f7cf
4 changed files with 7 additions and 2 deletions
2
lab4/zad6/Cargo.lock
generated
2
lab4/zad6/Cargo.lock
generated
|
@ -275,7 +275,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zad4"
|
name = "zad6"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"dashmap",
|
"dashmap",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
[package]
|
[package]
|
||||||
name = "zad4"
|
name = "zad6"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,8 @@ fn write_max(results_map: &DashMap<u64, Vec<Stats>>) -> DashMap<u64, u64> {
|
||||||
|
|
||||||
fn main() -> io::Result<()> {
|
fn main() -> io::Result<()> {
|
||||||
|
|
||||||
|
rayon::ThreadPoolBuilder::new().stack_size(1024 * 1024 * 1024).build_global().unwrap();
|
||||||
|
|
||||||
let m = 20;
|
let m = 20;
|
||||||
|
|
||||||
let asc_results: Arc<DashMap<u64, Vec<Stats>>> = Arc::new(DashMap::new());
|
let asc_results: Arc<DashMap<u64, Vec<Stats>>> = Arc::new(DashMap::new());
|
||||||
|
|
|
@ -292,8 +292,10 @@ impl SplayTree {
|
||||||
if node.parent() == self.root {
|
if node.parent() == self.root {
|
||||||
self.stats.reads += 1;
|
self.stats.reads += 1;
|
||||||
if node == node.parent().left() {
|
if node == node.parent().left() {
|
||||||
|
self.stats.reads += 1;
|
||||||
self.rotate_right(node.parent());
|
self.rotate_right(node.parent());
|
||||||
} else {
|
} else {
|
||||||
|
self.stats.reads += 1;
|
||||||
self.rotate_left(node.parent());
|
self.rotate_left(node.parent());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -382,6 +384,7 @@ impl SplayTree {
|
||||||
let mut temp = &self.root;
|
let mut temp = &self.root;
|
||||||
unsafe {
|
unsafe {
|
||||||
loop {
|
loop {
|
||||||
|
self.stats.comparisons += 1;
|
||||||
let next = match key.cmp(&(*temp.0).key) {
|
let next = match key.cmp(&(*temp.0).key) {
|
||||||
Ordering::Less => &mut (*temp.0).left,
|
Ordering::Less => &mut (*temp.0).left,
|
||||||
Ordering::Greater => &mut (*temp.0).right,
|
Ordering::Greater => &mut (*temp.0).right,
|
||||||
|
|
Loading…
Reference in a new issue