0% found this document useful (0 votes)
186 views

CS2040 CheatSheet

To reverse a data structure like a priority queue, use Collections.reverseOrder() comparator; to reverse a list, use Collections.reverse() which only works for lists. Graph coloring is a useful technique for solving graph problems.

Uploaded by

789ianwong
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
186 views

CS2040 CheatSheet

To reverse a data structure like a priority queue, use Collections.reverseOrder() comparator; to reverse a list, use Collections.reverse() which only works for lists. Graph coloring is a useful technique for solving graph problems.

Uploaded by

789ianwong
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

SSSP Problem

1. To reverse a data structure, use Collections.reverseOrder() to return a


comparator to be used.
* e.g. new PriorityQueue<>(Collections.reverseOrder())

2. To reverse a list, use Collections.reverse()


* Note that this only works for list!

3. Graph colouring can be a very useful technique in solving graph


problems!

You might also like