Skip to content

Commit bffbc66

Browse files
author
Amogh Singhal
authored
Update Interview_Questions.md
1 parent 4fe8fda commit bffbc66

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Interview_Questions.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
## 1. How to find the middle element of a linked list in one pass
1+
## 1. How to find the `middle element` of a linked list in one pass
22
Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. When `p` reaches the end of the linked list. `q` will be in the middle of the list.
33

4-
## 2. How to find the loop or cycle in a linked list in one pass
4+
## 2. How to find the `loop` or `cycle` in a linked list in one pass
55
Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. If `p` and `q` are pointing to the same node, there is a loop or cycle present.
66

7-
## 3. How to find the `k th` element from a linked list in one pass
7+
## 3. How to find the `k th` element from the end of a linked list in one pass
88
Solution: Start with two pointer `p` and `q`. When the `p` pointer reahces upto the `k th` element, increment `q`.When `p` reaches the end of the list. `q` is ponting to the element 'k th' from the end.

0 commit comments

Comments
 (0)