Skip to content

Commit 54f2702

Browse files
committed
测试ArrayToCircularDoublyTreeList
1 parent 457513d commit 54f2702

File tree

168 files changed

+595
-123
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

168 files changed

+595
-123
lines changed

4ueAj6/circular-linked-list.ts renamed to 4ueAj6/ArrayToCircularLinkedList.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ListNode } from "../reverse-linked-list/ListNode.ts";
2-
export function Array_to_circular_linked_list(
2+
3+
export function ArrayToCircularLinkedList(
34
array: Array<number>,
45
): ListNode | null {
56
if (array.length === 0) {

4ueAj6/test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
2-
import insert from "./index.ts";
2+
33
import { ListNode as Node } from "../reverse-linked-list/ListNode.ts";
4-
import { Array_to_circular_linked_list } from "./circular-linked-list.ts";
4+
import { ArrayToCircularLinkedList } from "./ArrayToCircularLinkedList.ts";
5+
import insert from "./index.ts";
56

6-
Deno.test("insert-into-a-sorted-circular-linked-list", () => {
7+
Deno.test("insert-into-a-sorted-ArrayToCircularLinkedList", () => {
78
const head = new Node(1);
89
head.next = head;
910
const node = new Node(2);
@@ -15,7 +16,7 @@ Deno.test("insert-into-a-sorted-circular-linked-list", () => {
1516
assertEquals(result?.next?.next?.val, 3);
1617
assertEquals(result?.next?.next?.next?.val, 1);
1718
});
18-
Deno.test("insert-into-a-sorted-circular-linked-list", () => {
19+
Deno.test("insert-into-a-sorted-ArrayToCircularLinkedList", () => {
1920
const inputs: Array<[number[], number]> = [
2021
[[1, 2], 3],
2122
[[3, 4, 1], 2],
@@ -26,9 +27,9 @@ Deno.test("insert-into-a-sorted-circular-linked-list", () => {
2627
const outputs = [[1, 2, 3], [3, 4, 1, 2], [1], [1, 0]];
2728

2829
assertEquals(
29-
outputs.map(Array_to_circular_linked_list),
30+
outputs.map(ArrayToCircularLinkedList),
3031
inputs.map(([array, insertVal]) => {
31-
const head = Array_to_circular_linked_list(array);
32+
const head = ArrayToCircularLinkedList(array);
3233
// console.log(head);
3334
const result = insert(head, insertVal);
3435
// console.log(result);

NYBBNL/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { inorder } from "../binary-tree-inorder-traversal/inorder.ts";
22
import { TreeNode } from "../binary-tree-inorder-traversal/TreeNode.ts";
3+
34
export default function increasingBST(root: TreeNode | null): TreeNode | null {
45
if (!root) return null;
56
const tree = new TreeNode();

README.md

Lines changed: 1 addition & 1 deletion

add-strings/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
2+
23
import addStrings from "./index.ts";
4+
35
Deno.test("add-strings", () => {
46
const outputs = ["134", "533", "0"];
57

add-to-array-form-of-integer/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
2+
23
import addToArrayForm from "./index.ts";
4+
35
Deno.test("add-to-array-form-of-integer", () => {
46
const inputs = [
57
[[1, 2, 0, 0], 34],

all-ancestors-of-a-node-in-a-directed-acyclic-graph/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
2+
23
import getAncestors from "./index.ts";
4+
35
Deno.test("all-ancestors-of-a-node-in-a-directed-acyclic-graph", () => {
46
const outputs = [
57
[[], [], [], [0, 1], [0, 2], [0, 1, 3], [0, 1, 2, 3, 4], [0, 1, 2, 3]],

all-elements-in-two-binary-search-trees/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { TreeNode } from "../binary-tree-inorder-traversal/TreeNode.ts";
22
import { inorder } from "./inorder.ts";
33
import { merge_sort } from "./merge_sort.ts";
4+
45
export default function getAllElements(
56
root1: TreeNode | null,
67
root2: TreeNode | null,

all-elements-in-two-binary-search-trees/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
2+
23
import getAllElements from "./index.ts";
4+
35
Deno.test("all-elements-in-two-binary-search-trees", () => {
46
const inputs = [
57
[

all-oone-data-structure/test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { assertEquals } from "https://deno.land/[email protected]/testing/asserts.ts";
22
import { runScript } from "leetcode-class";
3+
34
import AllOne from "./index.ts";
45

56
Deno.test("all-oone-data-structure", () => {

0 commit comments

Comments
 (0)