Coder Social home page Coder Social logo

disco-assignments's Introduction

DisCO-Assignments

Brief:

Given a graph G in the form of Adjacency matrix representation. The graph has to be read from a file in the following format โ€“ Sample input file: 0,1,1,0,0 1,0,0,1,1 1,0,0,0,0 0,1,0,0,0 0,1,0,0,0 Write a Program that checks whether the given graph is a height balanced tree or not. You can assume ith vertex to be the root of the tree. Value of i has to be taken by the program using a scanf() statement. The output has to be displayed over the terminal. You can assume that the number of vertices in the whole graph to be less than 10.

  1. If graph is not tree output will be directly "Graph IS NOT A TREE".
  2. If graph is a tree the program will ask for the value of the root 'i'.
  3. The output on the terminal will be "Graph is A HEIGHT BALANCED TREE" or "Graph is NOT A HEIGHT BALANCED TREE" for the input root node value.

There are four test input files attached which are as follows:

input1.txt This contains the adjacency matrix for a graph with 5 vertices which is a tree and is height balanced when root is any of the nodes 1, 2, 3, 4, 5.

input2.txt This contains the adjacency matrix for a graph with 5 vertices which is a tree and is height balanced when root is any of the nodes 2, 4, 5.

input3.txt This contains the adjacency matrix for a graph with 6 vertices which is a tree and is height balanced when root is any of the nodes 1, 2, 4, 6.

input4.txt This contains the adjacency matrix for a graph which is not a tree.

TODO 1. Review height balanced definiton

disco-assignments's People

Contributors

aagarwal-gtr avatar

Watchers

James Cloos avatar  avatar

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.