Exercise 3: Sorted Array of Edges
To improve performance, we wish to maintain edges in sorted order.
Rewrite the two functions below to achieve this:
void insertE(Graph g, Edge e) { ... }
void removeE(Graph g, Edge e) { ... }
|
Assume the existence of a binary search function:
int bSearch(Edge edges[], int lo, int hi, Edge e)
|
Assume that edges are defined as (x,y) where x<y
|