程序代写 [320] Search Order and Queue Structures

[320] Search Order and Queue Structures
– Weighted Path
What path will DFS choose? What path will BFS choose? What path would you choose?

Your task queue (“to do” list)
Stack
(FILO)
end end
Queue
front end (FIFO)
Priority Queue
smallest/biggest
end

Your task queue (“to do” list)
Stack
(FILO)
Queue
(FIFO)
Priority Queue
smallest/biggest
L.append(x)
end end
x = L.pop(-1)
front end
x = L.pop(0)
L.append(x)
end
L.append(x)
what operations are slow?
L.sort()
x = L.pop(-1)

Your task queue (“to do” list)
Stack
(FILO)
Queue
(FIFO)
Priority Queue
smallest/biggest
!
L.append(x)
end end
x = L.pop(-1)
!
x = L.pop(0)
L.append(x)
end
L.append(x)
what operations are slow?
front end
L.sort()
x = L.pop(-1)