Documentation
¶
Index ¶
- func Abs(a int) int
- func AlienDictionary(words []string) string
- func CheapestFlightsWithinKStops(n int, flights [][]int, src int, dst int, k int) int
- func CloneGraph(node *util.GraphNode) *util.GraphNode
- func CourseSchedule(numCourses int, prerequisites [][]int) bool
- func CourseScheduleII(numCourses int, prerequisites [][]int) []int
- func GraphValidTree(n int, edges [][]int) bool
- func MinCostToConnectAllPoints(points [][]int) int
- func NetworkDelayTime(times [][]int, n int, k int) int
- func ReconstructItinerary(tickets [][]string) []string
- func SwimInRisingWater(grid [][]int) int
- type Edge
- type ItineraryPriorityQueue
- type MinHeap
- type PointsEdge
- type PriorityQueue
- type WaterMinHeap
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AlienDictionary ¶
func CourseSchedule ¶
func CourseScheduleII ¶
func GraphValidTree ¶
func NetworkDelayTime ¶
networkDelayTime calculates the time it will take for all nodes to receive a signal sent from a given node.
func ReconstructItinerary ¶
func SwimInRisingWater ¶
Types ¶
type Edge ¶
type Edge struct {
// contains filtered or unexported fields
}
Edge represents a directed edge with a weight.
type ItineraryPriorityQueue ¶
type ItineraryPriorityQueue []string
PriorityQueue implements a min-heap for strings to maintain lexical order
func (ItineraryPriorityQueue) Len ¶
func (pq ItineraryPriorityQueue) Len() int
func (ItineraryPriorityQueue) Less ¶
func (pq ItineraryPriorityQueue) Less(i, j int) bool
func (*ItineraryPriorityQueue) Pop ¶
func (pq *ItineraryPriorityQueue) Pop() interface{}
func (*ItineraryPriorityQueue) Push ¶
func (pq *ItineraryPriorityQueue) Push(x interface{})
func (ItineraryPriorityQueue) Swap ¶
func (pq ItineraryPriorityQueue) Swap(i, j int)
type MinHeap ¶
type MinHeap [][]int
MinHeap is a priority queue to store nodes and their cumulative distances from the start.
type PointsEdge ¶
type PointsEdge struct {
// contains filtered or unexported fields
}
Edge represents an edge in the graph
type PriorityQueue ¶
type PriorityQueue []*PointsEdge
PriorityQueue implements heap.Interface and holds Edges
func (PriorityQueue) Len ¶
func (pq PriorityQueue) Len() int
func (PriorityQueue) Less ¶
func (pq PriorityQueue) Less(i, j int) bool
func (*PriorityQueue) Pop ¶
func (pq *PriorityQueue) Pop() interface{}
func (*PriorityQueue) Push ¶
func (pq *PriorityQueue) Push(x interface{})
func (PriorityQueue) Swap ¶
func (pq PriorityQueue) Swap(i, j int)
type WaterMinHeap ¶
type WaterMinHeap [][3]int
MinHeap is a min-heap of [3]int arrays.
func (WaterMinHeap) Len ¶
func (h WaterMinHeap) Len() int
func (WaterMinHeap) Less ¶
func (h WaterMinHeap) Less(i, j int) bool
func (*WaterMinHeap) Pop ¶
func (h *WaterMinHeap) Pop() interface{}
func (*WaterMinHeap) Push ¶
func (h *WaterMinHeap) Push(x interface{})
func (WaterMinHeap) Swap ¶
func (h WaterMinHeap) Swap(i, j int)
Click to show internal directories.
Click to hide internal directories.