Skip to content

Instantly share code, notes, and snippets.

View jiachen247's full-sized avatar

jiachen :-) jiachen247

  • fb
  • Singapore
  • 19:54 (UTC +08:00)
View GitHub Profile
from dataclasses import replace
import numpy as np
class Node():
"""
Implements an individual node in the Decision Tree.
"""
def __init__(self, y):
spark@spark-VirtualBox:~$ unzip A0184022R_Lab1\ \(4\).zip
Archive: A0184022R_Lab1 (4).zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of A0184022R_Lab1 (4).zip or
A0184022R_Lab1 (4).zip.zip, and cannot find A0184022R_Lab1 (4).zip.ZIP, period.
spark@spark-VirtualBox:~$ unzip "A0184022R_Lab1\ \(4\).zip"
unzip: cannot find or open A0184022R_Lab1\ \(4\).zip, A0184022R_Lab1\ \(4\).zip.zip or A0184022R_Lab1\ \(4\).zip.ZIP.
graph = {
'a' : ['b','c'],
'b' : ['d'],
'c' : ['e'],
'd' : ['f'],
'e' : [],
'f' : []
}
visited = set() # List to keep track of visited nodes.
graph = {
'a' : ['b','c'],
'b' : ['d'],
'c' : ['e'],
'd' : ['f'],
'e' : [],
'f' : []
}
visited = set() # List to keep track of visited nodes.
graph = {
'a' : ['b','c'],
'b' : ['d'],
'c' : ['e'],
'd' : ['f'],
'e' : [],
'f' : [],
'e': []
}
import heapq
# heap = [5,4,6,10,2]
# heapq.heapify(heap)
# heapq.heappush(heap, 20)
# min_elem = heapq.heappop(heap)
def klargest(lst, k):
lst = [-x for x in lst]
heapq.heapify(lst) # O(n)
import React from "react";
import { BrowserRouter, Routes, Route, Link } from "react-router-dom";
export default function App() {
return (
<BrowserRouter>
<div>
<nav>
<ul>
<li>
"""
# Definition for a Node.
class Node(object):
def __init__(self, val=None, children=None):
self.val = val
self.children = children
"""
class Solution(object):
def postorder(self, root):
#include "HeaderFile.h"
void clangGood () {
// simple use after free
char *buf;
buf = (char*) malloc (50 * sizeof(char));
strcpy(buf, "Hello world!!");
free(buf);
char *c = buf; /*ERROR:Invalid memory access to already freed area*/
}