GithubHelp home page GithubHelp logo

hashtable-and-graph's Introduction

Hashtable-and-Graph

###Created by Nick Miethe

Everything except for MyHashTable, MyGraph, LinkedListNode and GraphLinkedList are factories, abstract classes, or interfaces that should not be directly used.

GraphLinkedList and LinkedListNode are custom implementations of LinkedList and Node classes specific to the requirements of the Graph and Hash Table.

To implement the graph, you first must use graph = GraphFactory.create(size) and then NodeFactory.create(nodes). Add the nodes to the graph with graph.addNodes(node,node,...). This adds the nodes to a HashTable. You can then add edges between each of these nodes with graph.addEdge(node, node). You can call boolean isAcyclic() on the graph at any point to test if a cycle exists. A few other public methods are: *boolean hasEdge(node,node)

  • Node lookupNode(id) //O(1) time
  • Node lookupNode(name) //worst case time O(n)
  • int[] sort()

The HashTable is implemented similarly with table = HashTableFactory.create(). To place objects in the table, table.put(key, value). The key variable will be hashed and and key, value combination will be store at the hashkey. You can call table.get(key) to return the value. Both key and value are generics. A few other public methods:

  • getNode(key) // worst case time O(n)
  • Value remove(key) // returns value if key is in list, else null

hashtable-and-graph's People

Contributors

miethe avatar

Watchers

 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.