Find Unique Permutations Starting with 1 of a Binary String Using C++

Prateek Jangid
Updated on 25-Nov-2021 13:26:02

441 Views

In the given problem, we are given a string consisting of 0’s and 1’s; we are required to find the total number of permutations such that the string starts with 1’s. As the answer can be a vast number, so we print as a mod with 1000000007.Input : str ="10101001001" Output : 210 Input : str ="101110011" Output : 56We will solve the given problem by applying some combinatorics and building up some formulas to solve this problem.Approach to find The SolutionIn the approach, we will calculate the number of 0's and 1's. Now let's suppose n is the ... Read More

Find Number of Unique Pairs in an Array Using C++

Prateek Jangid
Updated on 25-Nov-2021 13:04:53

1K+ Views

We require the appropriate knowledge to create several unique pairs in an array syntax in C++. In finding the number of unique pairs, we count all unique pairs in a given array, i.e., all possible pairs can be formed where each pair should be unique. For example −Input : array[ ] = { 5, 5, 9 } Output : 4 Explanation : The number of all unique pairs are (5, 5), (5, 9), (9, 5) and (9, 9). Input : array[ ] = { 5, 4, 3, 2, 2 } Output : 16Approach to find The SolutionThere are Two ... Read More

What is Multitasking Time Sharing Operating System

Bhanu Priya
Updated on 25-Nov-2021 12:11:06

4K+ Views

The different types of operating systems are as follows −Batch Operating SystemMultiprogramming Operating SystemMultitasking Operating SystemMultiprocessing Operating SystemReal time Operating SystemNow, let us discuss the Time sharing operating systemTime sharing Operating systemLogically, it is an extension of multiprogramming as in multi programming the user cannot interact properly with the system but in time-sharing it is possible because in this CPU executes multiple processes by switching among them and giving the CPU time to each process and in this time the user can also interact with the process.Time-sharing OS provides short response time as the user can also directly give instruction ... Read More

Find Number of Triangles Formed from Points on Three Lines Using C++

Prateek Jangid
Updated on 25-Nov-2021 12:10:27

304 Views

We are given several points present in 3 lines now; we are required to find how many triangles these points can form, for exampleInput: m = 3, n = 4, k = 5 Output: 205 Input: m = 2, n = 2, k = 1 Output: 10We will apply some combinatorics to this question and make up some formulas to solve this problem.Approach to find The SolutionIn this approach, we will devise a formula by applying combinatorics to the current situations, and this formula will give us our results.C++ Code for the Above ApproachHere is the C++ syntax which ... Read More

Find the Number of Triangles After N Moves Using C++

Prateek Jangid
Updated on 25-Nov-2021 12:06:21

189 Views

n the article, first, we have to draw a colored triangle. We need to take an uncolored triangle and divide the triangle into four small equilaterals. Triangles with the same area and keep doing it till the nth step and find the number of equilateral triangles present in the figure.Approach to find The SolutionThere are Two Approaches for this Solution and they are −Brute Force ApproachWe can observe that the number of triangles keeps increasing by some number (increasing by 3*previous_number + 2) after every step. So we can run a loop till n and calculate the number of triangles.Example#include ... Read More

What is a Batch Operating System

Bhanu Priya
Updated on 25-Nov-2021 12:01:54

3K+ Views

To avoid the drawbacks of early systems the batch processing systems were introduced. The early systems required more setup time.To overcome this drawback, batch processing is used where the more set up time was reduced by processing the jobs in batches in this approach similar jobs were sent to the CPU for processing and were run together.The important task of the batch processing system is to automatically keep executing the job in batches to reduce the setup time.In the early job processing systems, the jobs were placed in a job queue and the memory allocated or managed by the primary ... Read More

Characteristics of Batch, Embedded, Real-Time, and Mainframe Operating Systems

Bhanu Priya
Updated on 25-Nov-2021 11:58:50

2K+ Views

Let us understand the characteristics of mainframe operating systems.Characteristics of Mainframe operating systemsThe characteristics of Mainframe operating systems are explained below −These systems have a large number of CPUs each having great processing power. All the CPUs with great processing power are combined into the Mainframe which as a result has the greatest processing power.The memory of the mainframe operating system is very large. It can even be about more than 8GB.Increased Performance/throughput as task load is shared: Mainframes systems share the task load among different processors and input/output devices. Thus, the processing power and efficiency increases multifold.Supports Time Sharing ... Read More

History of the Windows Operating System and MS-DOS

Bhanu Priya
Updated on 25-Nov-2021 11:54:19

707 Views

In the year 1985, the operating system Windows was released by Microsoft. In the beginning, Windows was just a Graphical User Interface in its first version. Windows 1 is the name of the first version of Windows which was released in the year 1985.The purpose of Windows was to let people interact with the machine with a Graphical User Interface without using codes even for all purposes, even for starting a system.The three latest versions of windows are Windows 10 Home, Windows 10 Pro and Windows Enterprise.Process ManagementThe Windows operating system manages the process with the help of a function ... Read More

Levels of Memory in the Operating System

Bhanu Priya
Updated on 25-Nov-2021 11:52:43

792 Views

Inside the computer system the memory hierarchy is arranged from fastest to the slowest as given below −RegistersCaches memoryMain or Primary MemorySecondary MemoryThe memory hierarchy is depicted in the diagram given below −Let us discuss about each memory in detail.RegisterRegisters are very high speed memory, which is present inside the CPU. It is a temporary storage device that means it stores the data temporarily. Generally, they create a general purpose register file to store data. The register file capacity is 32 data words, and each register can be read or written from within a single clock cycle.Cache MemoryThe cache memory ... Read More

Levels of Computer System Organization

Bhanu Priya
Updated on 25-Nov-2021 11:50:44

8K+ Views

The level hierarchy of a computer system consists of different levels that connect the computer with the user which makes the use of the computer. It also explains how the computational activities are performed on the computer.The different levels of computer system level hierarchy are as follows −Level 0 − Digital Logic.Level 1 − Micro architectural level.Level 2 − Instruction set architecture.Level 3 − Operating system.Level 4 − Assembly language.Level 5 − High level language.Level 6 − User oriented.The figure given below depicts these levels −Computer System Level HierarchyLet us discuss about each level hierarchy in detail −Level 0 − ... Read More

Advertisements