A loopless algorithm for generating (k, m)-ary trees in Gray code order
A family of ( k , m )-ary trees was firstly introduced by Du and Liu when they studied hook length polynomial for plane trees. Recently, Amani and Nowzari-Dalini presented a generation algorithm to produce ( k , m )-ary trees of order n encoding by Z-sequences in reverse lexicographic order. In th...
Uložené v:
| Vydané v: | Optimization letters Ročník 15; číslo 4; s. 1133 - 1154 |
|---|---|
| Hlavní autori: | , , , |
| Médium: | Journal Article |
| Jazyk: | English |
| Vydavateľské údaje: |
Berlin/Heidelberg
Springer Berlin Heidelberg
01.06.2021
|
| Predmet: | |
| ISSN: | 1862-4472, 1862-4480 |
| On-line prístup: | Získať plný text |
| Tagy: |
Pridať tag
Žiadne tagy, Buďte prvý, kto otaguje tento záznam!
|
| Shrnutí: | A family of (
k
,
m
)-ary trees was firstly introduced by Du and Liu when they studied hook length polynomial for plane trees. Recently, Amani and Nowzari-Dalini presented a generation algorithm to produce (
k
,
m
)-ary trees of order
n
encoding by Z-sequences in reverse lexicographic order. In this paper, we propose a loopless algorithm to generate all such Z-sequences in Gray code order. Hence, the worst-case time complexity of generating one Z-sequence is
O
(
1
)
, and the space requirement of our algorithm is
2
n
+
O
(
1
)
. Moreover, based on this ordering, we also provide ranking and unranking algorithms. The ranking algorithm can be run in
O
(
max
{
k
m
n
,
n
2
}
)
time and
O
(
k
m
n
)
space, whereas the unranking algorithm requires
O
(
k
m
n
2
)
time and space. |
|---|---|
| ISSN: | 1862-4472 1862-4480 |
| DOI: | 10.1007/s11590-020-01613-z |