mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
clang-format and clang-tidy fixes for 4c1400db
This commit is contained in:
parent
4c1400dbcb
commit
9ef82d2556
@ -70,7 +70,7 @@ ListNode* middleNode(ListNode* head) {
|
|||||||
slowptr = slowptr->next;
|
slowptr = slowptr->next;
|
||||||
fastptr = fastptr->next->next;
|
fastptr = fastptr->next->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (fastptr->next) ? slowptr->next : slowptr;
|
return (fastptr->next) ? slowptr->next : slowptr;
|
||||||
}
|
}
|
||||||
} // namespace median_search2
|
} // namespace median_search2
|
||||||
@ -96,20 +96,20 @@ static void test() {
|
|||||||
ListNode* median = search::median_search2::middleNode(head1);
|
ListNode* median = search::median_search2::middleNode(head1);
|
||||||
assert(3 == median->val); // 3 is the value of the median node.
|
assert(3 == median->val); // 3 is the value of the median node.
|
||||||
std::cout << "test case:1 passed\n";
|
std::cout << "test case:1 passed\n";
|
||||||
|
|
||||||
// Clean up
|
// Clean up
|
||||||
while (head1) {
|
while (head1) {
|
||||||
ListNode* t = head1;
|
ListNode* t = head1;
|
||||||
head1 = head1->next;
|
head1 = head1->next;
|
||||||
delete t;
|
delete t;
|
||||||
}
|
}
|
||||||
delete head1;
|
delete head1;
|
||||||
delete temp;
|
delete temp;
|
||||||
|
|
||||||
// Test case # 2
|
// Test case # 2
|
||||||
auto* head2 = new ListNode;
|
auto* head2 = new ListNode;
|
||||||
head2->val = 1;
|
head2->val = 1;
|
||||||
|
|
||||||
ListNode* temp2 = head2;
|
ListNode* temp2 = head2;
|
||||||
for (int i = 1; i < 7; ++i) {
|
for (int i = 1; i < 7; ++i) {
|
||||||
auto temp3 = new ListNode;
|
auto temp3 = new ListNode;
|
||||||
@ -129,9 +129,9 @@ static void test() {
|
|||||||
head2 = head2->next;
|
head2 = head2->next;
|
||||||
delete t;
|
delete t;
|
||||||
}
|
}
|
||||||
delete head2;
|
delete head2;
|
||||||
delete temp2;
|
delete temp2;
|
||||||
|
|
||||||
std::cout << "test case:2 passed\n";
|
std::cout << "test case:2 passed\n";
|
||||||
std::cout << "--All tests passed--\n";
|
std::cout << "--All tests passed--\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user