We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 796f076 commit c779b9bCopy full SHA for c779b9b
header/forward_list.hpp
@@ -369,6 +369,27 @@ class forward_lists{
369
Allocator get_allocator()const noexcept{
370
return alloc;
371
}
372
+ bool check_cycle()const noexcept{
373
+ Node* slow = head->next;
374
+ Node* fast = head->next;
375
+ while(slow && fast && fast->next != nullptr){
376
+ slow = slow->next;
377
+ fast = fast->next->next;
378
+ if(fast == slow){
379
+ return true;
380
+ }
381
382
+ return false;
383
384
+ T get_middle()const noexcept{
385
386
387
+ while(slow && fast && fast->next){
388
389
390
391
+ return slow->data;
392
393
public:
394
/**
395
* @brief method untuk insertion val pada pos front
0 commit comments