tnode 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tnode.rb +25 -9
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31c82cfdf9d0b03e794553ada962ee3a1bed80421939bcaf455cb5d434c74f26
|
4
|
+
data.tar.gz: 329c673910cfe946af01c839e50add3bcbcfc83b2b3b2362876e1cdff7c54f20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c7a9cbe1216ab6db072014ecf6e3e6ad0060b58b7ea49edff99f64ae3fa76538d7f3e1df4c1f4eda2fb236ff869bfe513462aa36601155f0b076275a8ffe02b
|
7
|
+
data.tar.gz: dc2aad78d813c103280d2170944535f71da7755293c559ae3f8d8bf8d93d42f5af121474be9c22b069e05f434a83cc62f1af8432bd5b43eb33d06383909d4c8e
|
data/lib/tnode.rb
CHANGED
@@ -54,18 +54,34 @@ class Tnode
|
|
54
54
|
|
55
55
|
def print_struct
|
56
56
|
init_trav_links
|
57
|
-
re_print_struct
|
57
|
+
re_print_struct
|
58
58
|
end
|
59
59
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
60
|
+
# '├── '
|
61
|
+
# '│ '
|
62
|
+
# '└── '
|
63
|
+
# ' '
|
64
|
+
def re_print_struct(depth = 0, prefs = [])
|
65
|
+
puts data if depth == 0
|
66
|
+
|
67
|
+
# prefixes
|
68
|
+
trav_links.each_with_index do |child, i|
|
69
|
+
prefs.each do |pref|
|
70
|
+
print pref
|
71
|
+
end
|
72
|
+
if i == trav_links.size - 1 # is last?
|
73
|
+
prefs.push ' ' unless child.trav_links.empty? # has childs
|
74
|
+
print '└── '
|
75
|
+
puts child.data
|
76
|
+
child.re_print_struct(depth + 1, prefs) unless child.trav_links.empty?
|
77
|
+
prefs.pop
|
78
|
+
else
|
79
|
+
prefs.push '│ ' unless child.trav_links.empty? # has childs
|
80
|
+
print '├── '
|
81
|
+
puts child.data
|
82
|
+
child.re_print_struct(depth + 1, prefs) unless child.trav_links.empty?
|
83
|
+
end
|
66
84
|
end
|
67
|
-
puts
|
68
|
-
print ' '
|
69
85
|
end
|
70
86
|
|
71
87
|
def tree_find(key_data)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tnode
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rurika Misaka
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: My data structure homework
|
14
14
|
email: goblinmaiden1931@gmail.com
|