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
Um, bukankah ini hanya pencarian mendalam
Struktur ini seperti graf terarah dalam struktur data