Number of triangles in an undirected graph
I'm assuming that the graph is given as an adjacency matrix. The trivial algorithm for counting triangles goes over all triples of vertices $u,v,w$ and checks whether $\{u,v,w\}$ is a triangle, for a total running time of $\Theta(N^3)$. This can be improved using matrix multiplication: if $A$ is the adjacency matrix, then the number of triangles can be extracted from $\operatorname{Tr} A^3$, taking into account the number of vertices and edges in the graph (details left to you). This takes time $O(n^\omega)$, where $\omega$ is the exponent of matrix multiplication.