Found 27104 Articles for Server Side Programming

Modify array of strings by replacing characters repeating in the same or remaining strings

Divya Sahni
Updated on 25-Jul-2023 13:28:25

125 Views

Modifying an array of strings by replacing characters repeating in the same or remaining strings is a common problem in programming. It can be solved using hash tables, sets, arrays etc. The aim is to improve the time and space requirements while providing the same functionality. This problem can be encountered in many real-life scenarios, such as processing large text or cleaning up datasets with duplicates. Problem Statement Given an input string array arr[] containing lowercase and uppercase characters. The goal is to modify the array by removing characters from the strings which are repeating in the same string or ... Read More

Minimum number of basic logic gates required to realize given Boolean expression`

Divya Sahni
Updated on 25-Jul-2023 13:26:02

454 Views

Logic gates are the basic building block of a digital circuit. They take in one or two binary inputs and return a binary output. Since, using the term binary, the output and input can either be 0 or 1 or it can be said as “false” and “true” or “low” and “high”. There are 3 basic logic gates − AND Gate AND gate has two or more inputs and one output. It produces a high output if all inputs are high. The truth table for a two-input AND gate is given below − Input 1 Input 2 Output ... Read More

Check if it is possible to reach any point on the circumference of a given circle from origin

Divya Sahni
Updated on 25-Jul-2023 13:21:11

41 Views

The circumference of a circle can be defined as the outer boundary of the circle. It is the perimeter of a circle. Each point around a circle follows certain properties as follows − Point (x, y) lying inside the circle such that, $\mathrm{x^2 + y^2 < R^2}$ Point (x, y) lying on the circle such that, $\mathrm{x^2 + y^2 = R^2}$ Point (x, y) lying outside the circle such that, $\mathrm{x^2 + y^2 > R^2}$ where R = radius of the circle. Problem Statement Given a string S representing a sequence of moves (L, R, U, D) and ... Read More

Check if a given string is a comment or not

Divya Sahni
Updated on 25-Jul-2023 12:53:09

1K+ Views

In computer programming, comments are text written with the source code but ignored by the compiler or interpreter. They are used to provide readability of code by describing the code and its functionality for someone who is reading the code other than a compiler or interpreter. They are not executed and do not affect the functionality of the overall program, they are just for programmer guidance. Each programming language has a different syntax to represent comments. Here are a few examples − C/C++ − In C or C++, single-lined comments begin with ‘//’ and multi-liner comments are enclosed in ... Read More

Sum of Pairwise Products

Divya Sahni
Updated on 25-Jul-2023 12:47:33

678 Views

The pairwise product of a set X = {a, b, c} can be defined as the sum of the product of all possible set pairs. The pairs of the set are, Y = {a * a, a * b, a *c, b * b, b * c, c * c}, where the product is commutative. Thus, the pairwise product of set X is the summation of elements of set Y i.e. aa + ab + ac + bb + bc + cc. In mathematical terms, the sum of possible pair products can be depicted as, $$\mathrm{\displaystyle\sum\limits_{i=1, j=i}^{i\leq n, j\leq n}\:(i, ... Read More

How to Create a Dataset using PyBrain?

Prince Yadav
Updated on 24-Jul-2023 15:09:00

49 Views

In the field of machine learning, datasets are an essential component for training and testing models. The accuracy and reliability of a machine learning model largely depend on the quality of the dataset used for training. PyBrain, an open−source machine learning library, provides a framework for creating high−quality datasets. This article will explore the steps required to create a dataset using PyBrain. We will discuss how to import necessary libraries, create a SupervisedDataSet object, add data to the dataset, and access the data in the dataset. By the end of this article, readers will have a good understanding of ... Read More

How to Count Unique Values Inside a List in Python?

Prince Yadav
Updated on 24-Jul-2023 14:44:28

11K+ Views

Python offers various methods to manipulate lists, which are one of the most commonly used data structures. One common task when working with lists is to count the occurrences of unique values within them, which is often required in data analysis, processing, and filtering tasks. In this article, we will explore four different approaches to counting unique values inside a list in Python. In this article, we will cover using a set, a dictionary, list comprehension, and a Counter from the collections module. Each method has its own advantages and can be chosen based on the specific requirements of ... Read More

How to Count the Number of Rows of a Given SQLite Table Using Python?

Prince Yadav
Updated on 24-Jul-2023 14:36:32

3K+ Views

Counting the number of rows in an SQLite table is a common task in database management. Python, with its robust libraries and support for SQLite, provides seamless tools for this purpose. In this article, we will explore how to efficiently count rows in an SQLite table using Python, enabling effective data analysis and manipulation. By establishing a connection to the SQLite database, executing SQL queries, and extracting row counts, we will guide you through the process. Whether you're a novice or an experienced Python developer, mastering this technique will enhance your data−handling skills. By the end of this article, ... Read More

How to Count the Number of Lines in a CSV File in Python?

Prince Yadav
Updated on 24-Jul-2023 14:32:08

10K+ Views

Python is a popular programming language that is widely used for data analysis and scientific computing. It provides a vast range of libraries and tools that make data manipulation and analysis simpler and faster. One such library is Pandas, which is built on top of NumPy and provides easy−to−use data structures and data analysis tools for Python. In this tutorial, we will explore how to count the number of lines in a CSV file using Python and the Pandas library. Counting the number of lines in a CSV file is a common operation that is required in data analysis and ... Read More

How to Convert Wide Dataframe to Tidy Dataframe with Pandas stack()?

Prince Yadav
Updated on 24-Jul-2023 13:50:12

166 Views

Python has become one of the most popular programming languages for data analysis and manipulation, thanks to its rich libraries and frameworks. Among these libraries, Pandas stands out as one of the most valuable and powerful tools for data processing. With Pandas, you can easily load, transform, and analyze data in a wide variety of formats. In this tutorial, we will explore converting a wide data frame to a tidy data frame using the Pandas stack() function. Converting a wide data frame to a tidy one is an essential step in many data analysis workflows, as it allows for easier ... Read More

Advertisements