Rearrange Array to Maximize i * arr[i] Using C++

Prateek Jangid
Updated on 26-Nov-2021 10:41:11

954 Views

In this article, we will discuss the problem of rearranging a given array of n numbers. Basically, we have to select elements from the array. For selecting each element, we get some points that will be evaluated by the value of the current element * a number of elements selected before the current element. You should select elements to get maximum points. For Example −Input : arr[ ] = { 3, 1, 5, 6, 3 } If we select the elements in the way it is given, our points will be    = 3 * 0 + 1 * ... Read More

What is the CPU Control Register

Bhanu Priya
Updated on 26-Nov-2021 10:39:57

3K+ Views

Control register is called a processor register that changes or controls the general behaviour of a CPU or other services in the system.The common tasks performed by control registers are interrupt control, switching the addressing mode, paging control, and coprocessor control.Types of CPU Control RegisterThe different types of CPU control register are as follows −The control registers are those extra registers that are visible only in kernel mode.CR0 - Reads as 0, read-onlyCR1 - For general-purpose useCR2 - For general-purpose useCR3 - For general-purpose use and TLB interfaceCR4 - Processor Status RegisterCR5 - Interrupt Status RegisterCR6 - Interrupt Mask RegisterCR7 ... Read More

CPU General Purpose Registers

Bhanu Priya
Updated on 26-Nov-2021 10:35:49

14K+ Views

General purpose registers are additional registers that are present in CPU which is used for either memory address or data whenever needed. For example, storing current register content when there is an interruption.8086 processorLet us consider an 8086 processor. There are eight general purpose register in 8086 microprocessor which are explained below −AXThis is the accumulator of 16 bits and is separated into two 8-bits registers AH and AL to likewise perform 8-bits instruction. It is usually utilized for arithmetical and logical directions, yet in 8086 chips it isn't required to have an accumulator as the objective operand.Example − ADD ... Read More

I/O Structure Explained

Bhanu Priya
Updated on 26-Nov-2021 10:33:50

19K+ Views

I/O Structure consists of Programmed I/O, Interrupt driven I/O, DMS, CPU, Memory, External devices, these are all connected with the help of Peripheral I/O Buses and General I/O Buses.Different types of I/O Present inside the system are shown below −Programmed I/OIn the programmed I/O when we write the input then the device should be ready to take the data otherwise the program should wait for some time so that the device or buffer will be free then it can take the input.Once the input is taken then it will be checked whether the output device or output buffer is free ... Read More

Rearrange Array to Order: Smallest, Largest, 2nd Smallest, 2nd Largest Using C++

Prateek Jangid
Updated on 26-Nov-2021 10:32:44

821 Views

We are given an array; we need to arrange this array in an order that the first element should be a minimum element, the second element should be a maximum element, the third element should be 2nd minimum element, the fourth element should be the 2nd maximum element and so on for example −Input : arr[ ] = { 13, 34, 30, 56, 78, 3 } Output : { 3, 78, 13, 56, 34, 30 } Explanation : array is rearranged in the order { 1st min, 1st max, 2nd min, 2nd max, 3rd min, 3rd max } Input ... Read More

Distinguish Between Machine and Operating System Virtualization

Bhanu Priya
Updated on 26-Nov-2021 10:30:58

741 Views

Let us learn about machine virtualization.Machine VirtualizationThe diagram given below shows the machine virtualization −Operating system virtualizationThe diagram given below shows the operating system virtualization −DifferencesThe major differences between Machine virtualization and operating system virtualization are as follows −Machine virtualizationOperating system virtualizationIt refers to the creation of a virtual machine that acts like a real computer.It is a part of virtualization and is a type of server virtualization.It can be done by extracting the physical hardware with the help of VVM (Virtual Machine Monitor).With OS virtualization nothing is pre installed/ permanently loaded on the local device & no hard-disk drive ... Read More

Rearrange Array in Maximum Minimum Form Using C++

Prateek Jangid
Updated on 26-Nov-2021 10:26:52

340 Views

We are given a sorted array. We need to arrange this array in maximum, minimum form, i.e., the first element is the maximum element, the second element is the minimum element, the third element is 2nd maximum element, the fourth element is 2nd minimum element, and so on, for example −Input : arr[ ] = { 10, 20, 30, 40, 50, 60 } Output : { 60, 10, 50, 20, 40, 30 } Explanation : array is rearranged in the form { 1st max, 1st min, 2nd max, 2nd min, 3rd max, 3rd min } Input : arr [ ... Read More

Differentiate Between Multiprogramming, Multitasking, and Multiprocessing

Bhanu Priya
Updated on 26-Nov-2021 10:24:19

4K+ Views

Let us understand what multiprogramming is.MultiprogrammingIt is the ability of an operating system which executes more than one program on a single processor machine. More than one task or program can store or reside into the main memory at one point of time.In this concept the CPU executes some part of one program, and then continues with another part of the program, and so on. Because of this process, the CPU will never go into the idle state unless there is no process ready to execute at the time of Context Switching.The diagram given below depicts the multiprogramming −AdvantagesThe advantages ... Read More

Different Tasks in Real-Time Systems

Bhanu Priya
Updated on 26-Nov-2021 10:21:16

1K+ Views

In embedded system, real time means the following −The system responds to an event or request within timing constraints.System must use a real time operating system, that system can interrupt a running task.The system must be predictable. The system guarantees that important tasks get run in fixed time constraints.Real time systems work in time constraints and provide estimated time for critical situations.Embedded systems provide specific functions in a large operating system.TasksGenerally, the tasks in the system are said to be fully pre-emptive and that are used to communicate with the rest of the system via data read at the beginning ... Read More

Rank of All Elements in an Array Using C++

Prateek Jangid
Updated on 26-Nov-2021 10:20:02

1K+ Views

In the given problem, we need to rank all the given elements of an array, with the smallest number having the smallest rank and the largest having the largest rank. We also need to change the ranks of a number depending on their frequencies, for examples −Input : 20 30 10 Output : 2.0 3.0 1.0 Input : 10 12 15 12 10 25 12 Output : 1.5, 4.0, 6.0, 4.0, 1.5, 7.0, 4.0 Here the rank of 10 is 1.5 because there are two 10s present in the given array now if we assume they both take ... Read More

Advertisements