median_search2 {
70slowptr = slowptr->
next;
74 return(fastptr->
next) ? slowptr->
next: slowptr;
77voiddeleteAll(
const ListNode*
consthead) {
79deleteAll(head->next);
95 for(
inti = 2; i < 6; ++i) {
104temp->
next=
nullptr;
107assert(3 == median->
val);
108search::median_search2::deleteAll(head1);
109std::cout <<
"test case:1 passed\n";
116 for(
inti = 2; i < 7; ++i) {
122temp2->
next= temp3;
125temp2->
next=
nullptr;
128assert(4 == median1->
val);
129search::median_search2::deleteAll(head2);
130std::cout <<
"test case:2 passed\n";
132std::cout <<
"--All tests passed--\n";
ListNode()=default
default constructor
int val
the value stored in the node
ListNode(int x)
constructor with value for node->val provided
ListNode * next
pointer to the next node
ListNode(int x, ListNode *next)
constructor with values provided for node->val and node->next
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4