Found 34493 Articles for Programming

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

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

269 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

397 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

175 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

63 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

44 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

Advantages and Disadvantages of Three-tier Architecture

Neetika Khandelwal
Updated on 22-Aug-2023 17:21:29

2K+ Views

A 3−tier application architecture is a modular client−server architecture that consists of a presentation tier, an application tier, and a data tier. The presentation tier is a graphical user interface (GUI) that interacts with the other two tiers; the data tier stores information; the application tier manages logic. A 3−tier architecture has pros in terms of better horizontal scalability, performance, and availability. When there are three layers, each component can be produced concurrently by a separate team of programmers using a different programming language than the developers of the other levels. The 3−tier paradigm makes it simpler for an organization ... Read More

Fetching Zipcodes of Locations in Python using Uszipcode Module

Gaurav Leekha
Updated on 21-Aug-2023 17:46:19

772 Views

The Python Uszipcode module is a powerful tool for working with United States zip codes in Python. This module provides a comprehensive set of functions and classes for working with zip codes, including searching for zip codes, identifying the location associated with a zip code, and calculating the distance between two zip codes. In this article, we will provide a detailed overview of the Python Uszipcode module and how it can be used to solve a variety of problems. What is the Python Uszipcode Module? The Python Uszipcode module is a Python library for working with United States zip codes. ... Read More

Complete Guide to Python StringIO Module with Examples

Gaurav Leekha
Updated on 21-Aug-2023 17:44:26

994 Views

Sometimes we need data to be created or read in memory instead of actual files seen by the OS. This is where the Python StringIO module, an in-memory file-like object, comes into play. Read through this article to get a detailed explanation about the Python StringIO module. What is Python StringIO Module? Python StringIO module is an in-memory file-like object which can be used as both input and output to most of the functions expecting a standard file object. In other words, the file-like object acts like a regular file allowing most of the standard file I/O operations. One of ... Read More

Check Multiple Conditions in IF statement using Python

Gaurav Leekha
Updated on 21-Aug-2023 17:42:17

9K+ Views

When writing programs, it is often necessary to check multiple conditions in order to determine the appropriate course of action. In Python, the "if" statement is used to execute a block of code if a specific condition is true. However, in many cases, we need to check more than one condition at a time, which can be accomplished using logical operators, parentheses, and other tools. In this article, we will explore several techniques for checking multiple conditions within an "if" statement using Python. We will discuss the use of logical operators such as and, or, and not, as well as ... Read More

A Beginner’s Guide to Image Classification using CNN (Python implementation)

Gaurav Leekha
Updated on 21-Aug-2023 17:40:30

878 Views

Convolutional Neural Networks (CNNs) are a type of neural network that is specifically designed to process data with a grid-like topology, such as an image. CNNs are composed of a number of convolutional and pooling layers, which are designed to extract features from the input data, and a fully connected layer, which is used to classify the features. The primary advantage of CNNs is that they are able to automatically learn the features that are most relevant for the task at hand, rather than having to rely on manual feature engineering. This makes them particularly well-suited for image classification tasks, ... Read More

Advertisements