Sam-C137
User since Sep 19, 2024
1 Posts
Recent Posts
class DFS{public dfs(G: DFSGraph, startVert: number){let visited: boolean[] = Array<boolean>();// Pre-populate array:for(let i = 0; i < G.size; i++){visited.push(false);}let s: number[] = new Array();visited[startVert] = true;s.push(startVert);while(s.length > 0){const v = s.pop();for(let adjV of G.adj[v]){if(!visited[adjV]){visited[adjV] = true;s.push(adjV);}}}}public dfsRecursive(G: DFSGraph, startVert: number){let visited: boolean[] = Array<boolean>();// Pre-populate array:for(let i = 0; i < G.size; i++){visited.push(false);}this.dfsAux(G, startVert, visited);}private dfsAux(G: DFSGraph, v: number, visited: boolean[]){visited[v] = true;for(let adjV of G.adj[v]){if(!visited[adjV]){// this.foo(); // Something can happen before the visit.this.dfsAux(G, adjV, visited);// this.bar(); // Something can happen after the visit.}}}}
Post Statistics
Posts
No Posts Found
It looks like Sam-C137 has no public posts
Likes
Please Log In
You must be authenticated to view a user's likes
Profile Privacy
Multi-Factor Authentication
Multi-Factor Authentication (MFA) is an authentication method that requires you to provide two or more verification factors to gain access to your account. In addition to username and password, MFA requires you to verify your email on every login, which decreases the likelihood of someone stealing your account.
Change Password
Identity Color
Changes the color of your profile icon and cursor highlight in the live code editor. You and other users will be able to view this change.
Delete Account
Deleting your account is permanent. All data associated with your account will be lost.