Tuesday, January 20, 2015

cse 101 review for exam 1

https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&ie=UTF-8#q=adjacency%20list%20of%20g%5Er%20in%20linear%20time

Find the reverse graph of G : GR src: http://j.mp/jfindgr


runtime to add an edge to an adjacency list C++
add edge to an adjacency list src: http://j.mp/jadjcimplement
void addEdge(int src, int dest) --- inside AdjancecyList
{
       AdjListNode* newNode = newAdjListNode(dest);
       newNode->next = array[src].head;
       array[src].head = newNode;
       newNode = newAdjListNode(src);
       newNode->next = array[dest].head;
       array[dest].head = newNode;
}
O(1)