mirror of
https://hub.njuu.cf/TheAlgorithms/C-Plus-Plus.git
synced 2023-10-11 13:05:55 +08:00
Added @brief and wikipedia link to algo
This commit is contained in:
parent
7c71be9707
commit
8cd2e327ae
@ -1,9 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
|
* @brief Given a linked list L[0,....,n] of n numbers, find the middle node.
|
||||||
*
|
*
|
||||||
* @details
|
* @details The technique utilized in this implementation is the "Floyd's tortise and hare" approach. Wikipedia link to technique: https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare
|
||||||
* Given a linked list L[0,....,n] of n numbers, find the middle node.
|
|
||||||
* The technique utilized in this implementation is the "Floyd's tortise and hare" approach. Wikipedia link to technique: https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare
|
|
||||||
* This technique uses two pointers that iterate through the list at different 'speeds' in order to solve problems.
|
* This technique uses two pointers that iterate through the list at different 'speeds' in order to solve problems.
|
||||||
* In this implementation, for every iteration the slow pointer advances one node while the fast pointer advances two nodes.
|
* In this implementation, for every iteration the slow pointer advances one node while the fast pointer advances two nodes.
|
||||||
* The result of this is that since the fast pointer moves twice as fast as the slow pointer, when the fast pointer reaches the end of the list
|
* The result of this is that since the fast pointer moves twice as fast as the slow pointer, when the fast pointer reaches the end of the list
|
||||||
@ -39,7 +38,7 @@ struct ListNode {
|
|||||||
namespace search {
|
namespace search {
|
||||||
/**
|
/**
|
||||||
* @namespace median_search
|
* @namespace median_search
|
||||||
* @brief Functions for the Median Search algorithm implementation.
|
* @brief Functions for the Median Search algorithm implementation. Wkipedia link to algorithm: https://en.wikipedia.org/wiki/Median_search
|
||||||
*/
|
*/
|
||||||
namespace median_search2 {
|
namespace median_search2 {
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user