A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://TheAlgorithms.github.io/C-Plus-Plus/d8/dfa/median__search2_8cpp_source.html below:

TheAlgorithms/C++: search/median_search2.cpp Source File

Go to the documentation of this file. 53namespace

median_search2 {

70

slowptr = slowptr->

next

;

74 return

(fastptr->

next

) ? slowptr->

next

: slowptr;

77void

deleteAll(

const ListNode

*

const

head) {

79

deleteAll(head->next);

95 for

(

int

i = 2; i < 6; ++i) {

104

temp->

next

=

nullptr

;

107

assert(3 == median->

val

);

108

search::median_search2::deleteAll(head1);

109

std::cout <<

"test case:1 passed\n"

;

116 for

(

int

i = 2; i < 7; ++i) {

122

temp2->

next

= temp3;

125

temp2->

next

=

nullptr

;

128

assert(4 == median1->

val

);

129

search::median_search2::deleteAll(head2);

130

std::cout <<

"test case:2 passed\n"

;

132

std::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