Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions DSA/Linked_List/define.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [],
"source": [
"class Node:\n",
" def __init__(self, data):\n",
" self.data = data\n",
" self.next = None\n",
"\n",
" def __repr__(self):\n",
" return self.data"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"class LinkedList:\n",
" def __init__(self):\n",
" self.head = None\n",
"\n",
" def __repr__(self):\n",
" node = self.head\n",
" nodes = []\n",
" while node is not None:\n",
" nodes.append(node.data)\n",
" node = node.next\n",
" nodes.append(\"None\")\n",
" return \" -> \".join(nodes)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"None"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"l_list = LinkedList()\n",
"l_list"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [],
"source": [
"first_node = Node(\"a\")\n",
"l_list.head = first_node"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [],
"source": [
"second_node = Node(\"b\")\n",
"third_node = Node(\"c\")"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [],
"source": [
"first_node.next = second_node\n",
"second_node.next =third_node"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
28 changes: 28 additions & 0 deletions DSA/Linked_List/doughnut.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
while ('o_' in dir()) or (A := (0)
) or (B := 0) or print((
"\x1b[2J")) or not ((sin := ((
__import__('math'))).sin)) or not (
cos := __import__('math').cos) or (o_ := (
True)): [pr() for b in [[(func(), b) for ((z
)) in [[0 for _ in range(1760)]] for b in [[ (
"\n") if ii % 80 == 79 else " " for ii in range(
1760)]] for o, D, N in [(o, D, N) for j in range((
0), 628, 7) for i in range(0, 628, 2) for (c, d, e,(
f), g, l, m, n) in [(sin( i / 100), cos(j / 100),(
sin(A)), sin(j / 100), cos(A), cos(i / 100) ,
cos(B), sin(B))] for (h) in [d + 2] for (
D, t) in [ (1 / ( c * h * e + f * g + (5
)), c * h * g - f * e)] for (x, y) in [
(int( 40 + 30 * D * ( l * h * m - t * n)),
int( 12 + 15 * D * ( l * h * n + t * (m))))]
for (o, N) in [(x + 80 * y,int(8 * (( f * e - c
* d * g) * m - c * d * e - f * g - l * d * n)))] if
0 < x < 80 and 22 > y > 0] if D > z[o] for func in
[lambda: (z.pop((o))), lambda: z.insert((o), (D)
),(lambda: (b.pop( o))), lambda: b.insert((o),
".,-~:;=!*#$@"[ N if N > 0 else 0])]][ 0][1]
] for pr in [lambda: print("\x1b[H"),
lambda: print("".join(b))] if (A :=
A + 0.02) and ( B := B + 0.02)]
#..--~~EvanZhouDev:~~--.#
#...,2023,...#
9 changes: 9 additions & 0 deletions re_leet_code/merge_two_sorted_lists/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
def mergeTwoLists(list1, list2):
list3 = list1 + list2
return sorted(list3)


list1 = [1, 2, 4]
list2 = [1, 3, 4]

print(mergeTwoLists(list1, list2))