Server Side Programming Articles

Page 2010 of 2109

Working with csv files in Java

AmitDiwan
AmitDiwan
Updated on 17-Aug-2020 453 Views

OpenCSV has to be installed first, which is a parser library for Java. The dependency has to be mentioned in the pom.xml file in the maven project. After that, the below code can be utilized.Exampleimport java.io.FileReader; import java.io.*; public class Demo{    public static void readDataLineByLine(String file){       try{          FileReader my_filereader = new FileReader(file);          CSVReader csvReader = new CSVReader(my_filereader);          String[] nextRecord;          while ((nextRecord = csvReader.readNext()) != null){             for (String cell : nextRecord){         ...

Read More

What's the connection between Java and Blockchain?

AmitDiwan
AmitDiwan
Updated on 17-Aug-2020 269 Views

Blockchain has become a buzz word in the recent times. It is being tried to be implemented in every software for various purposes, to check how it would work efficiently given different scenarios. It is a decentralized technology. It basically is data that is digital in nature and every piece of data is known as a transaction. Hence, the date, time and amount of that specific transaction is stored in the blockchain. Every block is unique due to the unique code it has, that is also known as ‘hash’. It is created with the help of different specialized algorithms.Investors are ...

Read More

Maximum number of Zombie processes a system can handle in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 17-Aug-2020 277 Views

Given the task is to find the maximum number of Zombie processes that a system can handle or in other words, the program does not stop its execution.A Zombie process (also known as defunct process) is a process that has completed its process via exit() (system call) but still has an entry in the process table.Approach used in the below program as followsNote that should be added in order to run the program.In main() function initialize num = 0 of type int which we will iterate until the program stops being executed.To initiate a zombie process create a while statement ...

Read More

What are C++ features missing in Java?

AmitDiwan
AmitDiwan
Updated on 17-Aug-2020 1K+ Views

There are many features that can be seen in C++ but not in Java. A few of them have been listed below −No unsigned int option in JavaNo destructor in Java as well as ‘delete’ since garbage collector performs this operation for it.No friend classes or friend functions in Java.There are no pointers in Java.There is no typedef option in Java.Since Java is a purely object oriented language, there are no global variables or global functions.The concept of templates present in C++ can’t be found in Java.The ‘::’ scope resolution operator is not there, since there is no question of ...

Read More

Upper bound and Lower bound for non increasing vector in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Aug-2020 4K+ Views

In this article we are going to discuss the vector::upper_bound() and vector::lower_bound() for an array sorted in non-increasing order in C++ STL.Vectors are similar to the dynamic arrays; they have the ability to modify its size itself whenever a value is inserted into or removed from the container where we are storing the value.In a Vector, lower bound returns an iterator pointing to the first element in the range that does not compare the given value. Upper Bound returns an iterator pointing element in the range that smaller than given value.Input 30 30 30 20 20 20 10 10Output Lower bound of ...

Read More

Split the sentence into words in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Aug-2020 2K+ Views

Given is the task to split the sentence into words. In this, we will separate all the words present in sentence.Input I am a good boyOutput I am a good boyIn the above example we will print the single word in single line.Example#include #include #include Using namespace std; void split( string st){    String word = “ “;    for ( char s : st){       If (s== ‘ ‘){          Cout

Read More

Maximum and Minimum element of a linked list which is divisible by a given number k in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Aug-2020 264 Views

A linked list is a linear data structure in which elements are linked via pointers. Each element or node of a linked list has a data part and link, or we can say pointer to the next element in sequence. The elements can take noncontiguous locations in memory.We are given a singly linked list in which there is a data part and link to the next element. The other input is a number K. Task is to find the Maximum and Minimum element of a linked list which is divisible by the number K. The linear linked list can only ...

Read More

Maximum adjacent difference in an array in its sorted form in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Aug-2020 1K+ Views

We are given with an array. The array need not be sorted. The task is to find the maximum difference between adjacent elements of that array in its sorted form. So the first thing is to sort the array in increasing or decreasing order. Then we will iterate the array and calculate the adjacent difference of Arr[i+1]-Arr[i]. Then for each iteration we will compare this difference with the one which is found maximum so far.Input − Arr[] = [ 1, 5, 10, 2, 7 ]Output − Maximum adjacent difference in array in its sorted form is 3.Explanation − Sorted Arr[] ...

Read More

Maximize the sum of X+Y elements by picking X and Y elements from 1st and 2nd array in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Aug-2020 338 Views

For the given two arrays each of size N, the task is to find the maximum sum by choosing X elements from array 1 and Y elements from array 2.Let’s now understand what we have to do using an example −Input arr1 = {1, 2, 3, 4, 5} ; X=2 arr2 = {1, 3, 5, 2, 7}; Y=3Output Maximum sum here is : 24Explanation − We are selecting 2 number(s) from arr1 and 3 from arr2. Largest 2 of arr1 are 4, 5 and largest 3 of arr2 are 3, 5, 7. Total sum of these 5 elements is 24 which is ...

Read More

Maximize the given number by replacing a segment of digits with the alternate digits given in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 14-Aug-2020 382 Views

Given the task is to maximize a given number with ‘N’ number of digits by replacing its digit using another array that contains 10 digits as an alternative for all single-digit numbers 0 to 9, The given condition is that only a consecutive segment of numbers can be replaced and only once.Input N=1234, arr[]={3 ,0 ,1 ,5 ,7 ,7 ,8 ,2 ,9 ,4}Output 1257Explanation The number 3 can be replaced with its alternative 5= arr[3]The number 4 can be replaced with its alternative 7= arr[4]Input N=5183, arr[]={3 ,0 ,1 ,5 ,7 ,7 ,8 ,2 ,9 ,4}Output 7183Approach used in the below program as followsIn function ...

Read More
Showing 20091–20100 of 21,090 articles
Advertisements