I'm following the video on Youtube about algorithm and data structures from Princeton. I have installed java but the first program out there run two custom function "StIn" & "StOut" from Princeton library.
How to find & install from the terminal that library? I can't find anything...
Here is the code:
package DynamicConnectivityClient;
public class main {
public static void main(String[] args){
int N = StdIn.readInt();
UF uf = new UF(N);
while (!StdIn.isEmpty()){
int p = StdIn.readInt();
int q = StdIn.readInt();
if (!uf.connected(p, q)){
uf.union(p, q);
StOut.println(p + " " + q);
}
}
}
}
And the .txt file called "% more tinyUF"
10
4 3
3 8
6 5
9 4
2 1
8 9
5 0
7 2
6 1
1 0
6 7
I research what StdIn & StdOut are and find out I am missing a library I want to implement in my code
The Java libraries that Princeton uses in their textbooks are listed at introcs.cs.princeton.edu. They add:
...followed by an explanation of how to do that.
Alternatively, you could download the source code for StdIn and StdOut and add them as source files to your project.
Without dependency on Princeton libraries
But this is a case where you don't really need those libraries. Java offers these capabilities with Java standard libraries.
For instance, you could do this: