Found 33676 Articles for Programming

Flipkart Reviews Sentiment Analysis using Python

Atharva Shah
Updated on 22-Aug-2023 17:48:39

648 Views

One of the biggest online markets in India is Flipkart, where shoppers can buy everything from gadgets to apparel. Any commercial service must examine the tone of the evaluations in order to enhance their services as a result of the growing number of consumers and their feedback. To detect whether a text exhibits a positive, negative, or neutral attitude, Sentiment Analysis is a Natural Language Processing approach which we will be examining using Python to conduct sentiment analysis on product reviews in this technical blog. Installation and Syntax To perform sentiment analysis on Flipkart reviews, we will need to install ... Read More

Replace two Substrings (of a String) with Each Other

Neetika Khandelwal
Updated on 22-Aug-2023 18:05:28

197 Views

You are given three strings S, A and B. You have to replace every sub−string of S equal to A with B and every sub−string of S equal to B with A. There is a possibility that two or more sub−strings matching A or B overlap. To avoid this confusion about the situation, you have to find the leftmost sub−string that matches A or B, replace it, and then continue with the rest of the string. Input S = “aab”, A = “aa”, B = “bb” Output “bbb” Match the first two characters with A and ... Read More

Minimum Number of Operations to move all Uppercase Characters before all Lower Case Characters

Neetika Khandelwal
Updated on 22-Aug-2023 17:58:44

238 Views

You are given a string 'str' that contains both uppercase and lowercase letters. Any lowercase character can be changed to an uppercase character and vice versa in a single action. The goal is to print the least possible instances of this process that are necessary to produce a string containing at least one lowercase character, followed by at least one uppercase character. Input Output Scenarios First possible solution: the first 4 characters can be converted to uppercase characters i.e. “TUTORial” with 4 operations. Input str = “tutoRial” Output 1 Second possible solution: the third character ... Read More

Minimum number of given Operations Required to Convert a String to Another String

Neetika Khandelwal
Updated on 22-Aug-2023 17:50:09

1K+ Views

You are given two strings A and B, the task is to convert from string A to string B, if possible. You are allowed to perform only one operation that is to put any character from A and insert it at front. Check if it’s possible to convert the string. If yes, then output minimum number of operations required for transformation. Input output Scenarios Assume we have two strings A and B with values "ABD" and "BAD" respectively the operation need to take to convert the first string to the latter is 1 which is swapping the first two characters. ... Read More

Java ArrayList to print all possible words from phone digits

Neetika Khandelwal
Updated on 24-Oct-2024 19:27:59

454 Views

In this article, we will learn to generate all possible words from a string of phone digits using Java. Each digit on a mobile keypad corresponds to a set of letters, and our task is to find every possible combination of letters that can be formed by pressing those digits. For instance, if the input is "23, " the output would include combinations like "ad, " "ae, " "af, " and so on. We will implement a recursive approach to achieve this, allowing us to systematically generate and print all possible words corresponding to the given digits. Problem Statement Write ... Read More

Generate a String Consisting of Characters ‘a’ and ‘b’ that Satisfy the given Conditions

Neetika Khandelwal
Updated on 22-Aug-2023 17:43:57

567 Views

The task is to generate a string that consists of characters ‘a’ and ‘b’ which satisfies the condition mentioned below: str must have a length of A+B. The character 'a' must appear A times and the character 'b' must appear B times within the string. The sub−strings "aaa" and "bbb" should not appear in str. After generating the string, it should be printed. One possible solution is to first generate a string with all 'a's and 'b's, with 'a' occurring A times and 'b' occurring B times. Then, we can shuffle the string randomly until we find a ... Read More

First Come, First Serve ñ CPU Scheduling | (Non-preemptive)

Neetika Khandelwal
Updated on 22-Aug-2023 17:41:30

1K+ Views

FCFS CPU Scheduling (First Come, First Serve) is a fundamental CPU scheduling mechanism that executes programs in the order they are added to the ready queue. In other words, the first process to come will be carried out first, and so on. Since it uses a non−preemptive scheduling technique, a process that has been allocated to the CPU will keep running until it is finished or enters a waiting state. Scenario 1 Let's take a look at an example to understand FCFS CPU scheduling in more detail. Suppose we have three processes with the following arrival times and burst times: ... Read More

Finding Optimal Page Size

Neetika Khandelwal
Updated on 22-Aug-2023 17:36:59

494 Views

Operating system has a concept known as the optimal page size that is affected by a number of variables, such as the system architecture, the amount of physical memory at hand, and the workload of the running applications. Steps/ Approach The following steps can be used to find the ideal page size: Step 1: Establish the system's design:Different CPU designs support varied page sizes. For instance, x86 CPUs typically offer 4KB page sizes, whereas ARM CPUs support 4KB, 16KB, or 64KB page sizes. Step 2: Calculate the physical memory capacity:The ideal page size depends on the physical memory capacity. Larger ... Read More

Find time taken to Execute the Tasks in A Based on the Order of Execution in B

Neetika Khandelwal
Updated on 22-Aug-2023 17:34:51

175 Views

The goal is to determine the minimum time required to complete the tasks in queue A based on the order of execution in queue B, given two queues A and B, each of size N, where: Pop this task and run it if the task identified at the head of queue B is also at the head of queue A. Pop the current task from queue A and push it at the end if the task discovered at the front of queue B is not also found at the front of queue A. One unit of time is ... Read More

Find the Time Taken Finish Processing of given Processes

Neetika Khandelwal
Updated on 22-Aug-2023 17:31:50

136 Views

Given are N processes and two N−sized arrays, arr1[] and arr2[]. A process's time in the critical section is recorded in arr1[], and it’s time to finish processing after leaving the critical part is recorded in arr2. The goal is to determine how long it will take for each process to finish processing (both inside and outside of the critical section) in any given order. Input Output Scenarios Assume we have 3 arrays as shown below Input N = 3, arr1[] = {1, 4, 3}, arr2[] = {2, 3, 1} Output 9 The first process, at ... Read More

Advertisements