Coder Social home page Coder Social logo

coursera-dsa's Introduction

coursera-dsa

It contains my solutions to all Assignments on Coursera.

This repository is open for all kind of suggestions.

Contributors: Harsh Kumar

#Please add your name here while committing

coursera-dsa's People

Contributors

hadron43 avatar

Stargazers

Saatvik Bhatnagar avatar Shashank Daima avatar

Watchers

 avatar

coursera-dsa's Issues

Checking if a given directed Graph is a DAG

I implemented this problem in Java. (GraphAlgorithms/week2.../1_.../Acyclic.java)
https://github.com/hadron43/coursera-dsa/blob/master/GraphAlgorithms/week2_decomposition2/1_acyclicity/Acyclicity.java

You can view the problem state on: https://github.com/hadron43/coursera-dsa/blob/master/GraphAlgorithms/week2_decomposition2/decomposition2.pdf Page 5

I kept an ArrayList to keep track of the elements in the current call frame stack. I recursively call the explore method on the neighbors of the element. If the element is repeated in the same call frame, that means given graph has a cycle, and thus it is not a DAG.

I am looking for a better implementation rather than passing a copy of all visited elements in each recursive call.

Any help will be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.