How to find keys with given prefix in treemap by a high efficiency way ? #67

Closed
opened 2017-10-24 08:21:35 +00:00 by zhengxiaochuan-3 · 1 comment
zhengxiaochuan-3 commented 2017-10-24 08:21:35 +00:00 (Migrated from github.com)

How to find keys with given prefix in a high efficiency way ?

Enumerable functions like "select" "find" has always to traverse all the treemap ?

How to find keys with given prefix in a high efficiency way ? Enumerable functions like "select" "find" has always to traverse all the treemap ?
emirpasic commented 2017-10-24 12:29:47 +00:00 (Migrated from github.com)

Enumerable functions like "select" "find" has always to traverse all the treemap ?

that's correct, so that's not optimal.

it's better to find the nearest (or first) matching prefix in the tree and then traverse "left & right" in tree for as long as the prefix condition is satisfied and return those results.

that logic is not implemented in GoDS, but you do have access to all the nodes and could implement that custom functionality.

> Enumerable functions like "select" "find" has always to traverse all the treemap ? that's correct, so that's not optimal. it's better to find the nearest (or first) matching prefix in the tree and then traverse "left & right" in tree for as long as the prefix condition is satisfied and return those results. that logic is not implemented in GoDS, but you do have access to all the nodes and could implement that custom functionality.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
golibs/gms-gods#67
No description provided.