Krantik Chavan has Published 278 Articles

C++ Program to Implement the Schonhage-Strassen Algorithm for Multiplication of Two Numbers

Krantik Chavan

Krantik Chavan

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

1K+ Views

Schonhage-Strassen Algorithm is used to multiply two numbers. The SchonhageStrassen algorithm is an asymptotically fast multiplication algorithm for large integers. In practice the Schonhage-Strassen algorithm starts to outperform older methods like karatsuba and Toom-CooK for numbers beyond 2215 to 2217 (10, 000 to 40, 000 decimal) digits.AlgorithmBegin    function noOfDigit( ... Read More

DoubleStream empty() method in Java

Krantik Chavan

Krantik Chavan

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

68 Views

The empty() method of the DoubleStream class in Java returns an empty sequential DoubleStream.The syntax is as follows:static DoubleStream empty()To use the DoubleStream class in Java, import the following package:import java.util.stream.DoubleStream;Let us create an empty DoubleStream:DoubleStream doubleStream = DoubleStream.empty();Now, let us check the number of elements in the stream. It ... Read More

ArrayBlockingQueue poll() Method in Java

Krantik Chavan

Krantik Chavan

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

183 Views

The poll() method of the ArrayBlockingQueue class in Java retrieves and removes the head of this queue, or returns null if this queue is empty.The syntax is as follows:E poll()To work with ArrayBlockingQueue class, you need to import the following package:import java.util.concurrent.ArrayBlockingQueue;The following is an example to implement poll() method ... Read More

The clone() method of CopyOnWriteArrayList method in Java

Krantik Chavan

Krantik Chavan

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

182 Views

To return a shallow copy of the CopyOnWriteArrayList, use the clone() method.The syntax is as follows:public Object clone()To work with CopyOnWriteArrayList class, you need to import the following package:import java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class clone() method in Java:Example Live Demoimport java.util.concurrent.CopyOnWriteArrayList; public class Demo {    public ... Read More

How to add elements in Java ArrayBlockingQueue?

Krantik Chavan

Krantik Chavan

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

131 Views

To add elements to the ArrayBlockingQueue class, use the add() method.The syntax is as follows:boolean add(E ele)Here, ele is the element to be added to the queue.To work with ArrayBlockingQueue class, you need to import the following package:import java.util.concurrent.ArrayBlockingQueue;The following is an example to add elements in Java ArrayBlockingQueue class:Example Live ... Read More

Mode 1—strobed I/O

Krantik Chavan

Krantik Chavan

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

2K+ Views

We call mode 1 as the strobed Input Output or handshake Input Output. We use this mode when the data is supplied by the input device to the microprocessor at irregular interval of time. A port which is functioned to program in mode uses three handshake signals. These handshake signals ... Read More

Mode 2—bi-directional I/O

Krantik Chavan

Krantik Chavan

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

1K+ Views

In mode 0 or mode 1, a port works as an input port or an output port. It is dependent if an input device or an output device gets connected to the port. Moreover, this, mode 2 is often called as bi-directional handshake Input Output. It is beneficial for us ... Read More

C++ Perform to a 2D FFT Inplace Given a Complex 2D Array

Krantik Chavan

Krantik Chavan

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

902 Views

Fast Fourier transform (FFT) is an algorithm to compute the discrete Fourier transform (DFT) and its inverse. Basically Fourier analysis converts time (or space) to frequency and vice versa. A FFT rapidly computes transformations by factorizing the DFT matrix into a product of sparse (mostly zero) factors.AlgorithmBegin    Declare the ... Read More

What is Type_FORWARD_ONLY ResultSet in JDBC?

Krantik Chavan

Krantik Chavan

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

3K+ Views

A ResultSet interface in JDBC represents the tabular data generated by SQL queries. It has a cursor which points to the current row. Initially, this cursor is positioned before the first row.You can retrieve the column value at the current row using the getter methods getInt(), getString(), getDate() etc…To move ... Read More

Java Program to get Sub Set from TreeSet

Krantik Chavan

Krantik Chavan

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

110 Views

Let us first create a TreeSet and add elements:TreeSet treeSet = new TreeSet(); treeSet.add(10); treeSet.add(20); treeSet.add(30); treeSet.add(40); treeSet.add(50); treeSet.add(60); treeSet.add(70); treeSet.add(80); treeSet.add(90); treeSet.add(100);Now, let’s say you need to set sub set from 50 to 70, then use the subset() for it:SortedSet sub = treeSet.subSet(50, 70); System.out.println("Sub Set = " + ... Read More

Advertisements