Computer structure is the way that each component is arranged so that communication is possible.The structure of a computer is simple, and that can be represented in below diagram −Parts of ComputerThe computer structure in general, divided into five main parts, which are as follows −Input devicesOutput devicesI / O PortsCPU andMemoryLet us discuss each component in detail.Input DeviceAn input device is a computer hardware which handles input receiving from outside the system. The main function of the input device is to enter data or give commands by the user into the system.For example, the input devices are keyboards, mouse, ... Read More
In this article, we will understand the problem of finding trailing zeros of a given number N in the base 16 representation of its factorial for exampleInput : N = 7 Output : 1 Explanation : fact(7) = 5040 in base10 and 13B0 in base16 having 1 trailing zero. Input : N = 11 Output : 2 Explanation : fact(11) = 39916800 in base10 and 2611500 in base16 having 2 trailing zeroes.Let's first recap the process of converting any decimal number from one base to another; let's take an example of converting (5040)10 to (?)16i.e., dividing the number by ... Read More
A computer has several modules, with possibly more than one instance of each.The system hardware consists of the following −KeyboardDisplayPrinterCPU BoardMemory BoardI/O BoardThe keyboard, display and printing devices need an interface so that it interacts with the system and the I/O board provides that interface for communication, that interacts is a system bus.The figure given below is of the computer hardware−Processor/CPUIt is the heart of the computer that controls the operations of the computer and also performs the data processing functions.CPU performs the operations like exchanging data with memory with the help of memory address register and memory buffer register.CPU ... Read More
The operating system (OS) acts as a manager for all the I/O device, memory, CPU, file storage resources and allocates them to specific programs and users, whenever necessary to perform a particular task. Therefore, the operating system is the resource manager that means it can manage the resources of a computer system internally.The operating systems are important and should be correctly used when writing the user applications. Large and complex systems have high economic impact and this result in interesting problems of management.Few systems are involved in the design and implementation of OS but, nevertheless many general techniques have to ... Read More
In this article, we are given two strings, and we need to find out how many substrings of the 1st string can be found in the 2nd string(the exact substring can occur multiple times). For exampleInput : string1 = “fogl” string2 = “google” Output : 6 Explanation : substrings of string1 present in string2 are [ “o”, “g”, “l”, “og”, “gl”, “ogl” ]. Input : string1 = “ajva” string2 = “java” Output : 5 Explanation : substrings of string1 present in string2 are [ “a”, “j”, “v”, “a”, “va” ].Approach to find The SolutionLet's discuss how we ... Read More
A computer system consists of many resources like hardware and software, which are useful to complete a task. The common required resources are input/output devices, memory, file storage space, CPU etc.The operating system acts as a manager for all the above resources and allocates them to specific programs and users, whenever necessary to perform a particular task. Therefore, the operating system is the resource manager that means it can manage the resources of a computer system internally. The resources are processor, memory, files, and I/O devices.An operating system is the interface between the user and the machine. Before there were ... Read More
In this article, you will learn about the approaches to find the number of substrings (non-empty) that you can form in a given string.Input : string = “moon” Output : 10 Explanation: Substrings are ‘m’, ‘o’, ‘o’, ‘n’, ‘mo’, ‘oo’, ‘on’, ‘moo’, ‘oon’ and ‘moon’. Input : string = “yellow” Output : 21Approach to find The SolutionLet the length of the string be n, so looking at the example above, we understand that to find all possible numbers of substrings, we need to add substrings of length n, (n-1), (n-2), (n-3), (n-4), ......2, 1.Total number of substrings = n ... Read More
To find the probability of numbers’ parity, i.e., is it even or odd, and for the given ranges. For each query, we need to print p and q representing the probability by p / q, for example.Input : N = 5, arr[] = { 6, 5, 2, 1, 7 } query 1: 0 2 2 query 2: 1 2 5 query 3: 0 1 4 Output : 0 3 4 1 2In this problem, we will maintain two arrays containing the number of odd and even numbers present until that index. This simplifies our problems, and now we need ... Read More
In this problem we are given a binary tree and we are required to perform dfs from a particular node in which we assume the given node as the root and perform dfs from it.In the above tree suppose we are required to perform DFS from node FIn this tutorial we are going to apply some unorthodox methods so that it will decrease our time complexity substantially and thus we will be able to run this code for higher constraints also.Approach − In this approach we are not simply going to go the naive way i.e. where we simply apply ... Read More
Given n, r, k, now we have to find how we can select r things from n so that specific k things always occur together, for example.Input : n = 8, r = 5, k = 2 Output : 960 Input : n = 6, r = 2, k = 2 Output : 2We need a little knowledge for this problem because this problem is asking us to find the permutation of n and r such that k things come together.Approach to Find the SolutionWe need to formulate our formula for this question, and that will ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP