Skip to content

Latest commit

 

History

History
20 lines (15 loc) · 446 Bytes

merge.md

File metadata and controls

20 lines (15 loc) · 446 Bytes

merge

Description : The list::merge() is an inbuilt function in C++ STL which merges two sorted lists into one.

Example :

    // declaring the lists 
    // initially sorted 
    std::list<int> list1 = { 10, 20, 30 }; 
    std::list<int> list2 = { 40, 50, 60 }; 
  
    // merge operation 
    list2.merge(list1); 
  
    std::cout << "List:  "; 
    for (auto value : list2) {
        std::cout << value << " "; 
    }