Smita Kapse has Published 498 Articles

C++ Program to Find number of Ways to Partition a word such that each word is a Palindrome

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

203 Views

Here we shall discuss a C++ Program to find number of ways to Partition a word in such a way that each word is a Palindrome.AlgorithmsBegin    Take the word as input.    Function partitionadd(vector &u, string &s, vector &tmp, int index):    if (index == 0)       ... Read More

How to do alphanumeric sort in MongoDB?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

566 Views

You need to set numericOrdering: true for alphanumeric sort. Let us first create a collection with documents −> db.alphanumericSortDemo.insertOne({"StudentId":"STU1010"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf149adceb9a92e6aa194c") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU1101"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf14a2dceb9a92e6aa194d") } > db.alphanumericSortDemo.insertOne({"StudentId":"STU1901"}); {    "acknowledged" : true,    "insertedId" ... Read More

How to perform intersection of sets between the documents in a single collection in MongoDB?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

173 Views

You can use $setIntersection for this. Let us first create a collection with documents −> db.setInterSectionDemo.insertOne( ...    {"_id":101, "Value1":[55, 67, 89]} ... ); { "acknowledged" : true, "insertedId" : 101 } > db.setInterSectionDemo.insertOne( ...    {"_id":102, "Value2":[90, 45, 55]} ... ); { "acknowledged" : true, "insertedId" : 102 } ... Read More

mbrtowc() function in C/C++

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

225 Views

This mbrtowc() function is used to convert multibyte sequence to wide character string. This returns the length of the multibyte characters in byte. The syntax is like below.mbrtowc (wchar_t* wc, const char* s, size_t max, mbstate_t* ps)The arguments are −wc is the pointer which points where the resulting wide character ... Read More

Search for documents matching first item in an array with MongoDB?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

149 Views

Let us first create a collection with documents −> db.matchingFirstItemInTheArrayDemo.insertOne(    {       "ClientDetails": [          {             "ClientName": "Larry",             "ClientAge":28          }       ]    } ); { ... Read More

How to add button to notifications in android?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

2K+ Views

This example demonstrate about How to add button to notifications in androidStep 1 − Create a new project in Android Studio, go to File ⇒ New Project and fill all required details to create a new project.Step 2 − Add the following code to res/layout/activity_main.xml.     Step 3 ... Read More

Catch block and type conversion in C++

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

190 Views

In this section, we will see how to use the catch block for exception handling and the type conversion in C++.At first, let us see a code, and we will see what will be the output, and how they are generating.Example#include using namespace std; int main() {    try{ ... Read More

Implement multiple conditions in MongoDB?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

248 Views

Let us first create a collection with documents −> db.multipleConditionDemo.insertOne({"_id":1, "Name":"John"}); { "acknowledged" : true, "insertedId" : 1 } > db.multipleConditionDemo.insertOne({"_id":2, "Name":"Carol"}); { "acknowledged" : true, "insertedId" : 2 } > db.multipleConditionDemo.insertOne({"_id":3, "Name":"Sam"}); { "acknowledged" : true, "insertedId" : 3 } > db.multipleConditionDemo.insertOne({"_id":4, "Name":"David"}); { "acknowledged" : true, "insertedId" : ... Read More

How to create Horizontal Slider in Java?

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

510 Views

To create Horizontal slider in Java, use the Swing JSlider. Let us first create a frame and a Horizontal slider in it −JFrame frame = new JFrame("Frame with Slider"); JSlider slider = new JSlider(JSlider.HORIZONTAL, 0, 100, 70);Now, we will set the values for the slider. Display the ticks −slider.setMinorTickSpacing(5); slider.setMajorTickSpacing(20); ... Read More

C qsort() vs C++ sort()

Smita Kapse

Smita Kapse

Updated on 30-Jul-2019 22:30:26

579 Views

Here we will see what are the differences between qsort() in C, and sort() in C++.The C provides qsort() function, that can be used for sorting an array. The function arguments and syntax is like below.void qsort(void *base, size_t num, size_t size, int (*comparator) (const void*, const void*));This function takes ... Read More

Advertisements