Update README.md

This commit is contained in:
bt3gl 2023-08-08 17:43:53 -07:00 committed by GitHub
parent 039bc676f7
commit 39a321a8e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,4 +1,4 @@
## Linked Lists
## linked list
<br>
@ -35,7 +35,7 @@ class Node:
* two pointers can be used to solve several problems:
* getting the kth from last node: have two pointers, where one is `k` nodes ahead of the other, when the node ahead reaches the end, the other node is `k` behind.
* detecting cycles: have two pointers, where one pointer increments twice as much as the other. if the two pointers meet, there is a cycle. if there is no cycle, the faster pointer takes `N/2` to reach the end of the list (`N` being the length).
* getting in the middle node: have two pointers, where one pointer increments twices as much as the other. when the faster node reaches the end of the list, the slower node will be at the middle.
* getting in the middle node: have two pointers, where one pointer increments twice as much as the other. when the faster node reaches the end of the list, the slower node will be at the middle.
<br>