【发布时间】:2014-06-23 16:47:09
【问题描述】:
谁能帮我哪个数据结构代表 Javascript 中的以下场景。感谢帮助。 我正在研究不同的选项,例如树遍历、双向链表,但需要更好的输入。
用例:我的来自服务器的对象表示如下
behaviour Id 1 [checkbox]
Combinable is [2,3]
Behaviour 2 [checkbox]
combinable is [8]
Behaviour 3 [checkbox]
combinable is [5]
Behaviour 4 [checkbox]
combinable is [7]
Behaviour 5 [checkbox]
combinable is []
Behaviour 6 [checkbox]
combinable is []
Behaviour 7 [checkbox]
combinable is []
Behaviour 8 [checkbox]
combinable is [9]
Behaviour 9 [checkbox]
combinable is []
考虑到以下场景,我需要双向遍历。
用例 1: 当用户选择行为 id 1 时, [1,2,8,9] 和 [1,3,5] 应启用。其余复选框将被禁用。
用例 2:这是双向的。 继续用例 1,当用户选择 8 并取消选择 id 1 时,应启用 [8,9] 但应禁用 [1,2,3,4,5,6]。
我编辑了问题以确保它更易于理解..谢谢。
【问题讨论】:
标签: javascript data-structures