-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/find-median-in-a-stream/0 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
def heapify(arr,n,i): | ||
while True: | ||
left=2*i+1 | ||
right=2*i+2 | ||
smallest=i | ||
|
||
if left < n and arr[left] > arr[smallest]: | ||
smallest=left | ||
|
||
if right < n and arr[right] > arr[smallest]: | ||
smallest=right | ||
|
||
if smallest==i: | ||
break | ||
arr[smallest],arr[i]=arr[i],arr[smallest] | ||
i=smallest | ||
|
||
|
||
def HeapSort(arr,n): | ||
for i in range(n//2-1,-1,-1): | ||
heapify(arr,n,i) | ||
|
||
for i in range(n-1,0,-1): | ||
arr[0],arr[i]=arr[i],arr[0] | ||
heapify(arr,i,0) | ||
|
||
|
||
if __name__=="__main__": | ||
arr=[2,3,23,12,45,67,97,89,76] | ||
HeapSort(arr,len(arr)) | ||
print(arr) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# No URL provided | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/add-1-to-a-number-represented-as-linked-list/1 | ||
class Solution: | ||
class Node: | ||
def __init__(self,data) -> None: | ||
self.next=None | ||
self.data=data | ||
|
||
def __init__(self) -> None: | ||
self.head=None | ||
|
||
def insert(self,value): | ||
new_node=self.Node(value) | ||
if self.head==None: | ||
head=new_node | ||
return | ||
new_node.next=self.head | ||
self.head=new_node | ||
|
||
def display(self): | ||
n=self.head | ||
if n: | ||
while n: | ||
print(n.data, end=' ') | ||
n=n.next | ||
def solve(self, *args, **kwargs): | ||
pass | ||
|
||
|
||
if __name__=="__main__": | ||
obj=Solution() | ||
obj.insert(10) | ||
print(obj.display()) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/middle-of-the-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/circular-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/intersection-of-two-linked-lists/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/intersection-of-two-sorted-linked-lists/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/merge-two-sorted-lists/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/middle-of-the-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/move-last-element-to-front-of-a-given-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/nth-node-from-end-of-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/remove-duplicate-element-from-sorted-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/remove-duplicates-from-sorted-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/remove-linked-list-elements/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/delete-node-in-a-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/reverse-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/reverse-a-doubly-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/reverse-a-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/sort-a-linked-list-of-0s-1s-or-2s/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/flatten-a-linked-list-with-next-and-child-pointers/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/flattening-a-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/lru-cache/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/a-linked-list-with-next-and-arbit-pointer/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/merge-sort-for-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/merge-k-sorted-lists/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/quick-sort-on-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/quicksort-on-singly-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/reverse-nodes-in-k-group/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# No URL provided | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/add-two-numbers-represented-by-linked-lists/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/check-if-linked-list-is-pallindrome/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/clone-a-linked-list-with-next-and-random-pointer/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/reverse-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/copy-list-with-random-pointer/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/given-only-a-pointer-to-a-node-to-be-deleted-in-a-singly-linked-list-how-do-you-delete-it/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/delete-nodes-which-have-a-greater-value-on-right-side/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/design-browser-history/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/design-hashmap/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/detect-loop-in-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/detect-and-remove-loop-in-a-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/design-hashset/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/find-first-node-of-loop-in-a-linked-list/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/flattening-a-linked-list/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://practice.geeksforgeeks.org/problems/intersection-point-in-y-shapped-linked-lists/1 | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://www.geeksforgeeks.org/write-a-function-to-get-the-intersection-point-of-two-linked-lists/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/lru-cache/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/linked-list-cycle/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Problem URL: https://leetcode.com/problems/linked-list-cycle-ii/ | ||
class Solution: | ||
def solve(self, *args, **kwargs): | ||
pass |