Question 1 (40 marks) Suppose the following Figure depicts a
simple graph of customers’ online shopping patterns. Apply
breadth-first search (BFS) and depth-first search (DFS) to traverse
the graph separately. Whenever there is a choice, choose the node
in lexicographical order (e.g., given a choice between E and J, you
will choose E because E comes before J)
(a) Discuss the different between BFS and DFS. Support your
answer with examples and scenario using any online shopping
platform, e.g. Shopee, Lazada and eBay. [10 marks]
(b) Determine the outputs (nodes sequence) of the traversals
starting from node A. Include the detailed working steps as your
answer. i. BFS [15 marks] ii. DFS [15 marks]
Start here A с j B E G н H
Question 1 (40 marks) Suppose the following Figure depicts a simple graph of customers’ online shopping patterns. Apply
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am