Perform In-Place 2D FFT on Complex Array in C++

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

944 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 size of the array    Take the elements of the array    Declare three arrays    Initialize height =size of array and width=size of array    Create two outer loops to iterate on output data    Create two outer loops to iterate on input data    Compute real, img and ... Read More

Select Most Recent Date from Possible Timestamps in MySQL

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

163 Views

You can select most recent date out of a set of several possible timestamps with the help of ORDER BY clause.The syntax is as followsSELECT yourColumnName1, yourColumnName2, ...N FROM yourTableName ORDER BY yourTimestampColumnName DESC LIMIT 1;To understand the above syntax, let us create a table. The query to create a table is as followsmysql> create table MostRecentDateDemo    - > (    - > Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    - > Name varchar(10),    - > ShippingDate timestamp    - > ); Query OK, 0 rows affected (0.65 sec)Insert some records in the table using insert command. ... Read More

JDBC SQL Escape Syntax Explained

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

2K+ Views

The escape syntax gives you the flexibility to use database specific features unavailable to you by using standard JDBC methods and properties.The general SQL escape syntax format is as follow:{keyword 'parameters'}Following are various escape syntaxes in JDBC:d, t, ts Keywords: They help identify date, time, and timestamp literals. As you know, no two DBMSs represent time and date the same way. This escape syntax tells the driver to render the date or time in the target database's format{d 'yyyy-mm-dd'}Where yyyy = year, mm = month; dd = date. Using this syntax {d '2009-09-03'} is March 9, 2009.Example//Create a Statement object ... Read More

Type Forward Only ResultSet in JDBC

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 the cursor and to navigate/iterate through the ResultSet the java.sql.ResultSet interface provides various methods such as next(), Previous(), first(), last(), relative(), absolute(), beforeFirst(), afterLast() etc...Type_FORWARD_ONLY Only ResultSetIn forward only ResultSet you can move the cursor only in forward direction. By default, a ResultSet is of type forward only.Read More

LocalDateTime plusNanos Method in Java

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

160 Views

An immutable copy of a LocalDateTime object where some nanoseconds are added to it can be obtained using the plusNanos() method in the LocalDateTime class in Java. This method requires a single parameter i.e. the number of nanoseconds to be added and it returns the LocalDateTime object with the added nanoseconds.A program that demonstrates this is given as follows −Example Live Demoimport java.time.*; public class Demo {    public static void main(String[] args) {       LocalDateTime ldt = LocalDateTime.now();       System.out.println("The current LocalDateTime is: " + ldt);       System.out.println("The LocalDateTime with 1000 nanoseconds added is: ... Read More

ListIterator Method of CopyOnWriteArrayList in Java

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

142 Views

The listIterator() method of the CopyOnWriteArrayList class in Java is used to return a list iterator over the elements in this list.The syntax is as followspublic ListIterator listIterator()To work with CopyOnWriteArrayList class, you need to import the following packageimport java.util.concurrent.CopyOnWriteArrayList;The following is an example to implement CopyOnWriteArrayList class listIterator() method in JavaExample Live Demoimport java.util.Iterator; import java.util.concurrent.CopyOnWriteArrayList; public class Demo {    public static void main(String[] args) {       CopyOnWriteArrayList arrList = new CopyOnWriteArrayList();       arrList.add(30);       arrList.add(40);       arrList.add(60);       arrList.add(70);       arrList.add(90);       arrList.add(100);   ... Read More

Delete Blank Rows in MySQL

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

24K+ Views

Use the delete command to delete blank rows in MySQL.The syntax is as followsdelete from yourTableName where yourColumnName=' ' OR yourColumnName IS NULL;The above syntax will delete blank rows as well as NULL row.To understand the concept, let us create a table.The query to create a table is as followsmysql> create table deleteRowDemo    -> (    -> Id int NOT NULL AUTO_INCREMENT PRIMARY KEY,    -> StudentName varchar(20)    -> ); Query OK, 0 rows affected (0.57 sec)Insert some records in the table using insert command.The query is as followsmysql> insert into deleteRowDemo(StudentName) values('John'); Query OK, 1 row affected ... Read More

MySQL Query to Remove Null Records in a Column

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

2K+ Views

To remove NULL records in a column, you can use delete command. Following is the syntax −delete from yourTableName where yourColumnName IS NULL;Let us first create a table −mysql> create table removeNullRecordsDemo    -> (    -> Name varchar(100)    -> ); Query OK, 0 rows affected (0.50 sec)Following is the query to insert records in the table using insert command −mysql> insert into removeNullRecordsDemo values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into removeNullRecordsDemo values(null); Query OK, 1 row affected (0.15 sec) mysql> insert into removeNullRecordsDemo values('Larry'); Query OK, 1 row affected (0.19 sec) ... Read More

Fill Array Values in Java

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

3K+ Views

Let us first create an int array −int[] arr = new int[10];Now, fill array values. Here, the numbers get added from the index 2 to 7 −Arrays.fill(arr, 2, 7, 100);Example Live Demoimport java.util.Arrays; public class Demo {    public static void main(String[] args) {       int[] arr = new int[10];       System.out.println("Array = "+Arrays.toString(arr));       Arrays.fill(arr, 2, 7, 100);       System.out.println("Fill = "+Arrays.toString(arr));    } }OutputArray = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] Fill = [0, 0, 100, 100, 100, 100, 100, 0, 0, 0]

Create a Random Graph Using Random Edge Generation in C++

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

1K+ Views

In this program a random graph is generated for random vertices and edges. The time complexity of this program is O(v * e). Where v is the number of vertices and e is the number of edges.AlgorithmBegin    Develop a function GenRandomGraphs(), with ‘e’ as the    number of edges and ‘v’ as the number of vertexes, in the argument list.       Assign random values to the number of vertex and edges of the graph,    using rand() function.       Print the connections of each vertex, irrespective of the       direction.       ... Read More

Advertisements