Interesting, I have never used inner classes, definitely something I need to learn more about.
Type: Posts; User: keepStriving
Interesting, I have never used inner classes, definitely something I need to learn more about.
On topcoder there are many problems that need to be solved by graphs, and since I can only create one class for a particular problem how can I solve these problems.
How can graphs be represented in a single class?
I know how to make a graph with several classes such as Vertex which defines the vertex, Stack which defines the Stack, Graph which lays out the...
I've managed to sort out that problem and can now get the correct values for all individual vertexes and their respective adjacencies, though when I try to count them all together I get an array out...
I have done the recursion to backtrack though don't understand your point here "but also note that as you backtrack nodes that were visited should marked as unvisited." Why would I do this as when I...
This is what I have changed which allows me in the example of 2 to go through all adjacencies 1, 3 and 5 though when it is finished it keep repeating 2 till it gets an error. Why is it doing this?...
I have made progress though am stuck at a particular point for each vertex, I can only get it to dfs through one adjacency instead of all adjacencies. So for example the vertex 2 has the adjacencies...
I have no experience, it's the first time I've come across the graph data structure so getting somewhat frustrated by the problem though also really interested by the topic of graph theory, once I...
I know I need to do DFS which will stop by somehow stop when it reaches N.
Do you think I should leave this problem and try to find easier problems to do with graphs as the more research I do the...
public static long countPasswords(int N){
boolean[][] adjacencyList = new boolean[10][10];
for(int i=0;i<10;i++){
for(int j=0;j<10;j++){
if(i==0){
if(j==7){...
I suppose graph is what you were trying to hint out to me which seems to fit right with the problem.
Hopefully I'll try it with a tree some other time. I've decided to go with multidimensional array.
So far this is the code, just missing the biggest piece in the puzzle which is to start going into...
I've set myself on the tree, though I'm unsure of how to implement a non binary tree in java, many resources I have come across say to create a separate tree class which I can't do. I have understood...
I chose a hash map which has a integer denoting the button pressed as a key, and an arraylist as a value which would show adjacencies that could then be accessed in turn. I'm stuck on what algorithm...
I was using long for "i" instead of int.Sorted that.
--- Update ---
How do you think I can move forward with this problem?
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class UnsealTheSafe {
public static void main(String[] args){
...
public class UnsealTheSafe {
public long countPasswords(int N){
for(int i = 0;i<N;i++){
}
TopCoder Statistics - Problem Statement
I was wondering if anyone could give me any tips on how to go about solving the following problem, the guide says that it is a dynamic programming problem,...