Nishtha Thakur has Published 564 Articles

C++ Program to Implement the Vigenere Cypher

Nishtha Thakur

Nishtha Thakur

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

6K+ Views

Vigenere Cipher is a kind of polyalphabetic substitution method of encrypting alphabetic text.Vigenere Cipher Table is used in which alphabets from A to Z are written in 26 rows, for encryption and decryption in this method.EncryptionKey: WELCOMEMessage: ThisistutorialspointHere we have to obtain a key by repeating the given key till ... Read More

C++ Program to Find the Longest Subsequence Common to All Sequences in a Set of Sequences

Nishtha Thakur

Nishtha Thakur

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

113 Views

Here we shall discuss a C++ program to find the Longest Subsequence Common to All Sequences in a Set of Sequences.AlgorithmsBegin Take the array of strings as input. function matchedPrefixtill(): find the matched prefix between string s1 and s2 :    n1 = store length of string s1.    n2 ... Read More

How to set the text of the JLabel to be right-justified and vertically centered in Java?

Nishtha Thakur

Nishtha Thakur

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

571 Views

To set the text of the label component to be right- justified and vertically centered, you need to set the alignment while creating a new label.Set the label to be on the right -JLabel label = new JLabel("Name", JLabel.RIGHT);Here, we have set the size of the label as well as ... Read More

Pointers, smart pointers and shared pointers in C++

Nishtha Thakur

Nishtha Thakur

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

4K+ Views

PointersPointers are used to store the address of variable.SyntaxType *pointer;InitializationType *pointer; Pointer = variable name;Functionspointers are used to store address of variable.pointers can have a null value assigned.pointer can be referenced by pass by reference.a pointer has its own memory address and size on the stack.Example Live Demo#include using namespace ... Read More

Concatenate fields in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

273 Views

To concatenate fields, use the $concat operator. Let us first create a collection with documents −>db.concatenateFieldsDemo.insertOne({"StudentFirstName":"Adam", "StudentLastName":"Smith"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6ebf46d78f205348bc62e") } >db.concatenateFieldsDemo.insertOne({"StudentFirstName":"John", "StudentLastName":"Doe"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6ebfc6d78f205348bc62f") } >db.concatenateFieldsDemo.insertOne({"StudentFirstName":"David", "StudentLastName":"Miller"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5cd6ec376d78f205348bc630") ... Read More

C++ Program to Implement Trie

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

Here we shall discuss a C++ Program to implement Trie. It is a tree based data structure, used for efficient retrieval of a key in a large data-set of strings.Functions and pseudocodesBegin function insert() :    If key not present, inserts key into trie. If the key is prefix of ... Read More

How to find datatype of all the fields in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

3K+ Views

Use typeof to find datatype of all the fields −typeof db.yourCollectionName.findOne().yourFieldName;Let us first create a collection with documents −> db.findDataTypeDemo.insertOne({"ClientName":"Chris", "isMarried":false}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf2064dceb9a92e6aa1952") }Following is the query to display all documents from a collection with the help of find() method −> db.findDataTypeDemo.findOne();This will ... Read More

getopt() function in C to parse command line arguments

Nishtha Thakur

Nishtha Thakur

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

7K+ Views

The getopt() is one of the built-in C function that are used for taking the command line options. The syntax of this function is like below −getopt(int argc, char *const argv[], const char *optstring)The opstring is a list of characters. Each of them representing a single character option.This function returns ... Read More

How to find Segmentation Error in C & C++ ? (Using GDB)

Nishtha Thakur

Nishtha Thakur

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

1K+ Views

The segmentation error is one of the runtime error, that is caused because of the memory access violation, like accessing invalid array index, pointing some restricted address etc. In this article, we will see how to detect this type of error using the GDB tool.Let us see the code and ... Read More

How to prepend string to entire column in MongoDB?

Nishtha Thakur

Nishtha Thakur

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

122 Views

Prepend string to entire column in MongoDB using aggregate framework. Let us first create a collection with documents −> db.prependDemo.insertOne({"StudentFirstName":"John"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf3bcedceb9a92e6aa1955") } > db.prependDemo.insertOne({"StudentFirstName":"Chris"}); {    "acknowledged" : true,    "insertedId" : ObjectId("5ccf3bd3dceb9a92e6aa1956") } > db.prependDemo.insertOne({"StudentFirstName":"Robert"}); {    "acknowledged" : true,   ... Read More

Advertisements