mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-12-25 22:46:20 +08:00
some mistakes in delete method and time comlexity (#322)
This commit is contained in:
parent
db83ec20ec
commit
3eab9eef40
@ -64,7 +64,7 @@ Remove(head, value)
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
n ← head.next
|
n ← head.next
|
||||||
while n = ø and value = n.value
|
while n = ø and value !== n.value
|
||||||
n ← n.next
|
n ← n.next
|
||||||
end while
|
end while
|
||||||
if n = tail
|
if n = tail
|
||||||
@ -100,7 +100,7 @@ end Reverse Traversal
|
|||||||
|
|
||||||
| Access | Search | Insertion | Deletion |
|
| Access | Search | Insertion | Deletion |
|
||||||
| :-------: | :-------: | :-------: | :-------: |
|
| :-------: | :-------: | :-------: | :-------: |
|
||||||
| O(n) | O(n) | O(1) | O(1) |
|
| O(n) | O(n) | O(1) | O(n) |
|
||||||
|
|
||||||
### Space Complexity
|
### Space Complexity
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user