Found 33676 Articles for Programming

C++ Program to Implement Sorting containers in STL

Jennifer Nicholas
Updated on 30-Jul-2019 22:30:25

181 Views

In this C++ program, we implement Sorting containers in STL.Functions and descriptions:Functions used here:    l.push_back() = It is used to push elements into a list from the front.    l.sort() = Sorts the elements of the list.    Where l is a list object.Example Code#include #include #include #include using namespace std; int main() {    list l;    list::iterator it;    int c, i;    while (1) {       cout

C++ Program to Implement Set_Union in STL

Farhan Muhamed
Updated on 13-May-2025 19:31:14

746 Views

The Set Union is an operation used to find all elements that are present in either of the sets or in both. In this article, we will learn how to use the set_union algorithm from the Standard Template Library (STL) in C++ to find the union of two sets. What is Set Union? The set union is an arithmetic operation performed between two sets to find all elements that are present in either of the sets or in both. In C++, we have set_union which is a built-in algorithm provided by C++ STL that computes the union of two ... Read More

C++ Program to Implement Set_Symmetric_difference in STL

Farhan Muhamed
Updated on 12-May-2025 19:45:08

380 Views

The Set Symmetric Difference is an operation used to find all elements that are present in either of the sets but not in both. In this article, we will learn how to use the set_symmetric_difference algorithm from the Standard Template Library (STL) in C++ to find the symmetric difference of two sets. What is Set Symmetric Difference? The set symmetric difference is an arithmetic operation performed between two sets to find all elements that are present in either of the sets but not in both. In C++, we have set_symmetric_difference(), which is a built-in function provided by C++ STL ... Read More

C++ Program to Implement Set_Intersection in STL

Farhan Muhamed
Updated on 12-May-2025 19:45:20

730 Views

The Set Intersection is an operation used to find all elements that are common in both sets. In this article, we will learn how to use the set_intersection algorithm from the Standard Template Library (STL) in C++ to find the intersection of two sets. What is Set Intersection? The set intersection is an arithmetic operation performed between two sets to find all elements that are common in both sets. In C++, we have set_intersection which is a built-in algorithm provided by C++ STL that computes the intersection of two sorted ranges of sets. That is, it returns the elements ... Read More

C++ Program to Implement Set_Difference in STL

Farhan Muhamed
Updated on 12-May-2025 19:45:32

933 Views

The Set Difference is an operation used to find all elements present in the first set but not in the second. In this article, we will learn how to use the set_difference algorithm from the Standard Template Library (STL) in C++ to find the difference of two sets. What is Set Difference? The set difference is an arithmetic operation performed between two sets to find all elements present in the first set but not in the second. In C++, we have set_difference which is a built-in algorithm provided by C++ STL that computes the set difference of two sorted ... Read More

C++ Program to Implement Set in STL

Farhan Muhamed
Updated on 12-May-2025 19:45:46

625 Views

Set is an associative container that stores unique elements in a sorted order. In this article, we will learn how to use the set container from the Standard Template Library (STL) in C++. What is Set? A Set is a container that stores data in a sorted order without any duplicates. Meaning, the duplicate values are automatically eliminated, and the elements are kept in ascending order by default. The STL library of C++ provides a pre-defined set container that uses a balanced binary search tree for storage. For example, in the code we have shown how data are ... Read More

C++ Program to Implement Queue in STL

Farhan Muhamed
Updated on 09-May-2025 15:39:16

874 Views

Queue is a linear data structure that follows the First In First Out (FIFO) principle. In this article, we will learn how to use the queue container from the Standard Template Library (STL) in C++. What is Queue? A Queue is a container that stores data in a sequential way. Meaning, the data that is inserted first to the queue is the one to be removed first from it. This is same as a queue of people where, the person who comes first to the queue will served first. The STL library of C++ provides a pre-defined queue container ... Read More

Create KeyValue Tuple from another collection in Java

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

86 Views

To create KeyValue tuple from another collection, use the fromCollection() method. We will be creating the tuple from List collection. Let us first see what we need to work with JavaTuples. To work with KeyValue class in JavaTuples, you need to import the following package.import org.javatuples.KeyValue;Note: Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples.Steps: How to run JavaTuples program in EclipseThe following ... Read More

Create LabelValue Tuple from another collection in Java

Krantik Chavan
Updated on 30-Jul-2019 22:30:25

91 Views

To create LabelValue tuple from another collection, use the fromCollection() method or the fromArray() method. Here, we will be creating LabelValue from List, therefore use the fromCollection() method.Let us first see what we need to work with JavaTuples. To work with LabelValue class in JavaTuples, you need to import the following package.import org.javatuples.LabelValue;Note: Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples.Steps: How ... Read More

Create Decade Tuple using with() method in Java

Daniol Thomas
Updated on 30-Jul-2019 22:30:25

106 Views

To create a Decade Tuple in Java, you can use the with() method. Let us first see what we need to work with JavaTuples. To work with Decade class in JavaTuples, you need to import the following package.import org.javatuples.Decade;Note: Download JavaTuples Jar library to run JavaTuples program. If you are using Eclipse IDE, then Right Click Project → Properties → Java Build Path → Add External Jars and upload the downloaded JavaTuples jar file. Refer the below guide for all the steps to run JavaTuples.Steps: How to run JavaTuples program in EclipseThe following is an example to create Decade Tuple ... Read More

Advertisements