Time: where is nodes and is edges. You visit each node at most once (the color check prevents revisits). You examine each edge at most twice (once from each endpoint). Linear in graph size. Space: for the color array.
BFS queue can hold up to nodes in the worst case (star graph). Same for DFS recursion stack. This is best. You cannot verify bipartiteness without looking at every edge, since one bad edge (completing an odd cycle) changes the answer.