Found 34484 Articles for Programming

XNOR of two numbers

Divya Sahni
Updated on 25-Jul-2023 12:16:12

380 Views

XNOR(Exclusive-NOR) gate is a digital logic gate that takes two inputs and gives one output. Its function is the logical complement of the Exclusive-OR (XOR) gate. The output is TRUE if both inputs are the same and FALSE if the inputs are different. The truth table of the XNOR gate is given below. A B Output 1 1 1 1 0 0 0 1 0 0 0 1 Problem Statement Given two numbers x and y. Find the XNOR of the two numbers. Sample Example 1 Input: x ... Read More

QuickSort using Random Pivoting

Divya Sahni
Updated on 04-Sep-2023 09:37:30

1K+ Views

Quick Sort is a Divide and Conquer algorithm. In this algorithm, we elect a pivot element and then partition the array around the pivot element. The two partitions are such that one part contains elements all lower than the pivot element and the other part contains elements all higher than the pivot element. Similarly, each part is further partitioned around a pivot selected in each part and this process is executed until one single element is reached. Choosing a Pivot A pivot can be chosen in an array as follows − A random pivot. Rightmost or leftmost element as ... Read More

Comparison between Tarjan’s and Kosaraju’s Algorithm

Way2Class
Updated on 21-Jul-2023 18:43:16

417 Views

Tarjan’s algorithm is to locate strongly linked components in a directed graph, Robert Tarjan created the graph traversal technique known as Tarjan's algorithm in 1972. Without going over previously processed nodes, it effectively locates and handles each highly related component using a depth-first search strategy and a stack data structure. The algorithm is often employed in computer science and graph theory and has several uses, including algorithm creation, network analysis, and data mining. Kosaraju’s algorithm consists of two passes over the graph. In the first pass, the graph is traversed in reverse order and a "finish time" is assigned ... Read More

Plotting Geospatial Data using GeoPandas

Shriansh Kumar
Updated on 21-Jul-2023 19:07:58

212 Views

GeoPandas, a widely used Python library build on top of the Pandas library to include the support of geospatial data. Here, geospatial data or geodata describes the information related to the various locations on Earth's surface. These datasets have many use cases including visualization of maps, urban planning, analysis of trade locations, network planning and so forth. In this article, we are going to explore how the GeoPandas library works and also, how to plot geospatial data using GeoPandas. Plotting Geospatial data using GeoPandas in Python Since GeoPandas extends the features of the Pandas library, we need to ... Read More

Longest substring having K distinct vowels

Way2Class
Updated on 21-Jul-2023 18:01:45

179 Views

In this article, we will explore the problem of finding the longest substring in a given string that contains K distinct vowels. The problem can be solved using different algorithms in C++. This problem is commonly encountered in the field of computer science, particularly in text processing and natural language processing tasks. It tests one's ability to manipulate strings and handle edge cases. Syntax In the realm of C++, the class std::string epitomizes a string datatype. This versatile entity enables storage and manipulation of character sequences. The template class std::vector embodies a dynamic array, granting the ability to resize arrays ... Read More

ProcessBuilder in Java to create a basic online Judge

Shriansh Kumar
Updated on 21-Jul-2023 22:36:54

176 Views

Online judge is a platform that serves to compile, execute and evaluate programming solutions to a given problem. It is widely used for problem solving and organizing programming contests. To create a basic online judge in Java using ProcessBuilder class, define an instance of ProcessBuilder and specify the name of program and commands as arguments The ProcessBuilder class is used to create and manage operating system processes. It allows us to chain multiple processes, where the output of one process can be used as the input to another process. Also, it provides a variety of built-in methods such as redirectOutput(), ... Read More

How to Add JAR file to Classpath in Java?

Shriansh Kumar
Updated on 21-Jul-2023 22:27:58

3K+ Views

While developing any Java application, we may require to use external libraries or modules that are packaged as JAR files. To use a JAR file in those Java applications, we need to add it to the classpath, which is a list of locations where the Java runtime can find and load classes. This article aims to explain how to add a JAR file to the classpath. We will start this explanation by introducing JAR Files. Java JAR File The full form of JAR is Java Archive File. Java provides this feature to bundle multiple Java program files as well as ... Read More

Difference between JIT and JVM in Java

Shriansh Kumar
Updated on 21-Jul-2023 22:19:19

483 Views

When we start learning Java, we often come across the terms like JIT and JVM. Having a good understanding of the relationship and differences between both terms is crucial, as they are part of fundamental concepts in the Java programming language. JVM is the main component of the Java Runtime Environment that executes Java bytecode, whereas JIT is a compiler available in the JVM. This article aims to explain the difference between JIT and JVM. JIT vs JVM in Java JVM It is an acronym that stands for Java Virtual Machine. The name itself suggests that it is something that ... Read More

Parallelizing a Numpy Vector Operation

Shriansh Kumar
Updated on 21-Jul-2023 19:17:50

228 Views

Numpy is a powerful Python library that serves to store and manipulate large, multi-dimensional arrays. Although it is fast and more efficient than other similar collections like lists, we can further enhance its performance by using the parallelizing mechanism. Parallelizing means splitting the tasks into multiple processes to achieve one single goal. Python provides several ways to parallelize a numpy vector operation including multiprocessing and numexpr module. Python Programs for Parallelizing a NumPy Vector Operation Let's discuss the ways to parallelize a numpy vector: Using multiprocessing Every Python program is considered as one single process and ... Read More

Difference Between Source Code and Byte Code

Shriansh Kumar
Updated on 21-Jul-2023 22:13:36

517 Views

When we start learning Java, we often come across the two terms Source code and Byte code. When a programmer writes Java code, it is in a form that a machine cannot understand. This code is termed as source code, which is easy to read and modify by humans, but not by machines. Therefore, before execution of code, we need to convert it into a machine readable format that is termed as machine code. However, Java first converts the source code to an intermediate code called byte code and then, into a machine code. Let’s discuss the difference between the ... Read More

Advertisements