src/sorting_algorithms/sorting
complete the 4 blank sorting algorithms
to test them
- run
sorting_algorithms/testing_main.py
to test your code - you can see plots of time used in
plots
, file name isTime used vs Lengths.png
src/sorting_algorithms/sorting
complete count sort and radix sort
to test them
- run
sorting_algorithms/testing_main.py
to test your code - you can see plots of time used in
plots
, file name isTime used vs Lengths (Linear Sorts).png
src/data_structures/binary_search_tree
and src/data_structures/heap
complete functions of the 2 data structures
to test them
- install dependency
graphviz
by runningpip install graphviz
in command line - run
data_structures/testing_main.py
to test your code - you can see plots of time used in
plots/bsts
andplots/heaps
完成这次的作业后请把作业发到我的企业微信。前3次作业已完成的同学请把test通过的截图(或者代码截图)发到我的企业微信。谢谢。
Find the union, and intersection of:
a)
b)
prove the universal properties of set union and intersection, for sets
$\forall X\subseteq D. A \cup B \subseteq X \iff (A \subseteq X \text{ and } B \subseteq X)$ $\forall X\subseteq D, X\subseteq A \text{ and } X\subseteq B \iff X \subseteq (A\cap B)$
Hints:
- remember how to prove 'if and only if' (two steps)
- use the definitions of
$\cup$ and$\cap$ $\forall x, x\in A\cup B \iff x\in A \vee x\in B$ $\forall x, x\in A\cap B \iff x\in A \wedge x\in B$
- use the definition of
$\subseteq$ $A\subseteq B\iff \forall a \in A,a\in B$
prove the universal properties of big union and big intersection, for a family of sets
$\forall X \subseteq D. \bigcup F \subseteq X \iff (\forall S \in F, S \subseteq X)$ $\forall X \subseteq D. X \subseteq \bigcap F \iff (\forall S\in F, X\subseteq S)$
Hints:
-
$F$ is a set of sets - the proof is quite similar to the previous proof
Let A={1,2,3,4}, B={a,b,c,d} and C={x,y,z}. Let R = {(1,a),(2,d),(3,a),(3, b),(3,d)}: A → B and S = {(b, x),(b, y),(c, y),(d,z)}: B → C.
Draw the internal diagrams of the relations. What is the composition S ◦ R : A → C.
go to the online editor
query the table with columns: cutomer - item - status
NOTE: assume order_id
is the same as shipping_id
result should look like: