What should I know about Depth-first search, Breath-first search and merge-sort algorithm? Give me an example to solve. Thanks
DepthfirstSearch and breadth first search algorithms helps to find the path,cycles in a directed or undirected graph. for further more go to following site. http://algs4.cs.princeton.edu/41undirected/ Merge-sort algorithm is based on divide and conquer technique.. Example if we want to sort 7 2 5 1 9 3 in ascending order the whole list is divided into two half parts.i.e. 7 2 5 as a single list and 1 9 3 as other list .later 7 2 5 is further divided into two halfsi.e 7 2 as 1-list and 5 as another list .The 1-list is sorted as 2 7 and merged with next list i.e 5. Now 7 2 5 is sorted as 2 7 5 and merged with other list 1 9 3.(1 9 3 not sorted) forming the sorting order.
Join our real-time social learning platform and learn together with your friends!