This is my summary of the Graphs and Paths chapter. All code is written in c# (converted from java).
Types of Graphs (E - Edges, V - Vertices)
Unweighted: O(|E|) Breadth-first search
Weighted, no negative edges: O(|E| log|V|) Dijkstra's algorithm
Weighted, negative edges: O(|E| * |V|) Bellman-Ford algorithm
Weighted, acyclic: O(|E|) Uses topological sort
A class to represent the Edges:
using System;
using System.Collections;
using System.Collections.Generic;
public class Edge
{
public Vertex dest; // Second vertex in Edge I am rereading some chapters in "Data Structures & Problem Solving Using Java". I just finished reading chapter 17 on linked lists. Here is the singly linked list and sorted linked list from this chapter done in c#.
LinkedList - the list itself
SortedLinkedList - the sorted linked list
ListNode - represents the node
LinkedListIterator - represents the position
using System;
using System.Collections.Generic;
namespace LinkedLists
{
public class ListNode
{
private T elem;
private ListNode nextNode;
public T Element
{
Recent comments
2 days 11 hours ago
5 days 13 hours ago
5 days 13 hours ago
6 days 17 hours ago
1 week 16 hours ago
2 weeks 19 hours ago
2 weeks 19 hours ago
2 weeks 4 days ago
2 weeks 5 days ago
2 weeks 5 days ago