Found 1862 Articles for Data Structure

Centered Square Number

Simran Kumari
Updated on 23-Aug-2023 10:02:42

90 Views

What do you understand by Centered Square Number? Let’s decode in this article. Firstly, what is square number? A square number, also known as a perfect square, is a non−negative integer formed by multiplying an integer by itself. A square number, in other words, is the result of multiplying a number by itself. For example, 1, 4, 9, 16, 25, 36, 49, 64, 81, and 100 are all square numbers. The sequence of square numbers can be represented by the formula n^2, where n is a positive integer. For instance, the first five square numbers are 1^2 = 1, 2^2 ... Read More

Centered Pentagonal Number

Simran Kumari
Updated on 23-Aug-2023 09:59:34

180 Views

What do you understand by a centered pentagonal number? Let’s decode in this article. First of all, what is a pentagon? You must be aware of this term. To recall, A pentagon is a geometric shape with five straight sides and five angles that is two−dimensional. The Greek terms "penta, " which means "five, " and "gonia, " which means "angle, " are the origin of the word "pentagon." All of the sides and angles make up a regular pentagon (equal in measure). The sum of all the angles of a regular pentagon, which has 108 degrees for each angle, ... Read More

Centered Octahedral Number

Simran Kumari
Updated on 23-Aug-2023 09:55:37

115 Views

What do you mean by a Centered octahedral number? Let’s decode. Firstly, what is an Octahedron? An octahedron is an eight−sided, equilateral triangle−shaped three−dimensional geometric shape. With 8 vertices, 12 edges, and 6 square faces, it is a polyhedron. One of the five Platonic solids, which are regular, convex polyhedra with symmetrical vertex arrangements and identical faces, is the octahedron. The octahedron has a variety of fascinating characteristics and uses, including crystallography, where it is used to describe the structure of certain crystals, and computer graphics, where it is used to model objects in three dimensions. Numerous other natural phenomena, ... Read More

Centered Heptagonal Number

Simran Kumari
Updated on 23-Aug-2023 09:50:57

94 Views

What do you understand by the term centered hepatgonal number? Let’s decode in this article. First of all, what is a heptagonal number? A heptagonal number is a figurate number representing the number of dots that can be arranged to form a regular heptagon (a seven−sided polygon). The formula for the nth heptagonal number is: n(5n−3)/2, where n must be a positive integer. The first few heptagonal numbers, for example, are: 1 is the first heptagonal number (corresponding to a heptagon with one dot). 7 is the second heptagonal number (corresponding to a heptagon with 7 dots). 18 is ... Read More

Cake Number

Simran Kumari
Updated on 23-Aug-2023 09:48:40

129 Views

What do you understand by the term `Cake Number`? Let's decode it in this article. The term "cake number" describes a concept of discrete geometry and combinatorics−related mathematical idea. It is built on the concept of the Lazy caterer's sequence. What is the Lazy Caterer's Sequence? The maximum number of pieces a disk (cake or pizza) can be sliced into using a specific number of straight slices is known as the Lazy caterer's sequence. Although it mentions a disk, we will consider a cake in our example. One straight cut can divide a cake into two pieces, two straight cuts ... Read More

Replace two Substrings (of a String) with Each Other

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

101 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

91 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

586 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

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

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

394 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

174 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

Advertisements