Skip to content

Commit f1ae84e

Browse files
committed
adding list of linkedlist questions
1 parent aac481e commit f1ae84e

File tree

3 files changed

+118
-0
lines changed

3 files changed

+118
-0
lines changed

.vscode/settings.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"terminal.integrated.fontSize": 18
3+
}

LecturesCode/BinarySearchLecture.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
class BinarySearchLecture {
2+
public static void main(String[] args) {
3+
int[] sarray = {10,20,30,55,65,87,98};
4+
int[] descarray = {98,58,48,32,22,20,10};
5+
int target = 22;
6+
int result = binarySearchI(sarray,target);
7+
System.out.println(result);
8+
result = binarySearchReverse(descarray,target);
9+
System.out.println(result);
10+
}
11+
12+
13+
public static int binarySearchI(int[] arr, int target) {
14+
int s=0,mid=0,e = arr.length-1;
15+
while(s<=e) {
16+
// Find Mid
17+
// mid = (s+e)/2;
18+
mid = s + (e-s)/2;
19+
// Element found at index mid
20+
if(arr[mid]==target) return mid;
21+
// Search in the right half
22+
else if(arr[mid]<target) s=mid+1;
23+
// Search in the left half
24+
else e = mid-1;
25+
}
26+
// Element not found in the array
27+
return -1;
28+
}
29+
30+
public static int binarySearchReverse(int[] arr, int target) {
31+
int s=0,mid=0,e = arr.length-1;
32+
while(s<=e) {
33+
// Find Mid
34+
// mid = (s+e)/2;
35+
mid = s + (e-s)/2;
36+
// Element found at index mid
37+
if(arr[mid]==target) return mid;
38+
// Search in the right half
39+
else if(arr[mid]>target) s=mid+1;
40+
// Search in the left half
41+
else e = mid-1;
42+
}
43+
// Element not found in the array
44+
return -1;
45+
}
46+
47+
}

LinkedList.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# LinkedList ♾️ DSA-Coding-Questions🚀
2+
3+
## BASIC Foundation Cocepts 💡
4+
### 💡Implement Linked List - [Leetcode](https://leetcode.com/problems/design-linked-list/description/)
5+
### 💡Reverse Linked List - [Leetcode](https://leetcode.com/problems/reverse-linked-list)
6+
### 💡Remove Duplicates from SortedList - [Leetcode](https://leetcode.com/problems/remove-duplicates-from-sorted-list/description/)
7+
### 💡Merge 2 Sorted Linked List [Leetcode](https://leetcode.com/problems/merge-two-sorted-lists/description/)
8+
9+
10+
<hr>
11+
12+
## Based on 📍Slow & Fast Pointer Questions ❤️
13+
14+
| LinkedList Questions | Practice Link | Code Solutions | Video Solutions | HINT
15+
-|-|-|-|-
16+
Detect Cycle/Loop in LinkedList| [Leetcode](https://leetcode.com/problems/linked-list-cycle) |
17+
Find Mid of LinkedList | [Leetcode](https://leetcode.com/problems/middle-of-the-linked-list)
18+
Intersection of 2 LinkedList | [Leetcode](https://leetcode.com/problems/intersection-of-two-linked-lists)
19+
Check LinkedList is Palindrome | [Leetcode](https://leetcode.com/problems/palindrome-linked-list)
20+
Remmove Kth Node from End of LinkedList | [Leetcode](https://leetcode.com/problems/remove-nth-node-from-end-of-list)
21+
22+
## Based on Swappings 🔁
23+
- Swap Nodes in Pairs | [Leetcode](https://leetcode.com/problems/swap-nodes-in-pairs/description/)
24+
- Swapping Nodes in Linkedlist |
25+
[Leetcode](https://leetcode.com/problems/swapping-nodes-in-a-linked-list)
26+
- Odd Even Linked List | [Leetcode](https://leetcode.com/problems/odd-even-linked-list/description/)
27+
28+
## Medium Questions ❤️‍🔥
29+
| LinkedList Questions | Practice Link | Code Solutions | Video Solutions | HINT
30+
| ------------- | :-------------: | :-------------: | :---------: |:---------: |
31+
Delete Given Node | [Leetcode](https://leetcode.com/problems/delete-node-in-a-linked-list/description/)
32+
Rotate Linked List | [Leetcode](https://leetcode.com/problems/rotate-list/description/)
33+
Delete Middle Node | [Leetcode](https://leetcode.com/problems/delete-the-middle-node-of-a-linked-list)
34+
35+
36+
## Hard Questions 💔
37+
| Array Questions | Practice Link | Code Solutions | Video Solutions | HINT
38+
-|-|-|-|-
39+
Coming Soon..
40+
---
41+
42+
<div align="center">
43+
44+
<a href="#">
45+
<img src="https://dcbadge.vercel.app/api/server/YvBacAxu?theme=discord" />
46+
</a>
47+
48+
<br />
49+
50+
<a href="https://www.youtube.com/@CodingWallah-Family/streams">
51+
<img src="https://img.shields.io/youtube/channel/subscribers/UC7HdeXvGFw962sWv31mjEqA?label=Coding%20Wallah%20-%20family&logo=youtube&logoColor=ff0000&style=for-the-badge" />
52+
</a>
53+
54+
<a href="https://www.youtube.com/@CodingWallahSir/videos">
55+
<img src="https://img.shields.io/youtube/channel/subscribers/UC2EF2l4DhSG3PVBXVyQhHfA?label=Coding%20Wallah%20Sir&logo=youtube&logoColor=f00&style=for-the-badge" />
56+
</a>
57+
58+
</div>
59+
60+
<!--
61+
62+
![Discord Server](https://dcbadge.vercel.app/api/server/YvBacAxu?theme=discord)
63+
64+
![Coding Wallah - Family](https://img.shields.io/youtube/channel/subscribers/UC7HdeXvGFw962sWv31mjEqA?label=Coding%20Wallah%20-%20family&logo=youtube&logoColor=ff0000&style=for-the-badge)
65+
66+
![Coding Wallah Sir](https://img.shields.io/youtube/channel/subscribers/UC2EF2l4DhSG3PVBXVyQhHfA?label=Coding%20Wallah%20Sir&logo=youtube&logoColor=f00&style=for-the-badge)
67+
68+
-->

0 commit comments

Comments
 (0)