mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 04:31:55 +08:00
Add JavaScript and TypeScript code of top_k and update some code style (#686)
* Update JS and TS code style * Add JavaScript and TypeScript code of top_k * Update top_k.ts * Apply suggestions from code review Co-authored-by: Justin Tse <xiefahit@gmail.com> * Apply suggestions from code review Co-authored-by: Justin Tse <xiefahit@gmail.com> --------- Co-authored-by: Yudong Jin <krahets@163.com>
This commit is contained in:
@ -70,7 +70,7 @@ class GraphAdjList {
|
||||
// 在邻接表中删除顶点 vet 对应的链表
|
||||
this.adjList.delete(vet);
|
||||
// 遍历其他顶点的链表,删除所有包含 vet 的边
|
||||
for (let set of this.adjList.values()) {
|
||||
for (const set of this.adjList.values()) {
|
||||
const index = set.indexOf(vet);
|
||||
if (index > -1) {
|
||||
set.splice(index, 1);
|
||||
|
||||
Reference in New Issue
Block a user