Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Latest commit

History

History
21 lines (16 loc) 路 493 Bytes

merge.md

File metadata and controls

21 lines (16 loc) 路 493 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 << " "; 
    }

Run Code