javascript - Carta alir untuk mendapatkan kedalaman, sila bantu pakar algoritma
仅有的幸福
仅有的幸福 2017-05-19 10:48:24
0
2
1113

Masalah ini telah mengganggu saya sejak sekian lama baru-baru ini saya mempunyai data json berikut

[
    {"prev_node": "0000000000000005","next_node": "0000000000000006"},
    {"prev_node": "0000000000000006","next_node": "0000000000000007"},
    {"prev_node": "0000000000000006","next_node": "0000000000000008"},
    {"prev_node": "0000000000000008","next_node": "0000000000000012"},
    {"prev_node": "0000000000000009","next_node": "0000000000000010"},
    {"prev_node": "0000000000000010","next_node": "0000000000000011"},
    {"prev_node": "0000000000000014","next_node": "0000000000000015"},
    {"prev_node": "0000000000000015","next_node": "0000000000000016"},
    {"prev_node": "0000000000000016","next_node": "0000000000000017"},
    {"prev_node": "0000000000000018","next_node": "0000000000000019"},
    {"prev_node": "0000000000000020","next_node": "0000000000000021"},
    {"prev_node": "0000000000000019","next_node": "0000000000000020"},
    {"prev_node": "0000000000000012","next_node": "0000000000000022"},
    {"prev_node": "0000000000000022","next_node": "0000000000000023"},
    {"prev_node": "0000000000000023","next_node": "0000000000000009"},
    {"prev_node": "0000000000000011","next_node": "0000000000000024"},
    {"prev_node": "0000000000000024","next_node": "0000000000000014"},
    {"prev_node": "0000000000000017","next_node": "0000000000000025"},
    {"prev_node": "0000000000000025","next_node": "0000000000000018"},
    {"prev_node": "0000000000000007","next_node": "0000000000000021"},
    {"prev_node": null,"next_node": "0000000000000005"},
    {"prev_node": "0000000000000021","next_node": null}
]

Antaranya, prev_node mewakili nod sebelumnya dan next_node ialah nod seterusnya Jika prev_node ialah Nod, ia mewakili nod semasa Jika next_node adalah nod, ia mewakili nod terakhir, carta alir berikut diperolehi

Cari nod proses terdalam semasa dan berapa banyak cawangan yang ada

Nota: Nod hanya boleh pergi ke bawah

仅有的幸福
仅有的幸福

membalas semua(2)
过去多啦不再A梦

Um, bukankah ini hanya pencarian mendalam

滿天的星座

Struktur ini seperti graf terarah dalam struktur data

Muat turun terkini
Lagi>
kesan web
Kod sumber laman web
Bahan laman web
Templat hujung hadapan