Found 1862 Articles for Data Structure

Smallest triangular number larger than p

Vaishnavi Tripathi
Updated on 11-Apr-2023 16:20:27

212 Views

We will discuss triangular numbers and how we can find the smallest triangular number just larger than a given number “num”. We will first discuss what exactly is a triangular number and then will find out the smallest triangular number just larger than “num” We will see two different approaches for the same. In the first approach, we will run a simple loop to generate the output, while in our second approach, we will first generate a general formula for calculating the desired number and then will directly apply that formula to get the smallest triangular number. Problem Statement We ... Read More

Pandigital Product

Vaishnavi Tripathi
Updated on 11-Apr-2023 16:19:20

171 Views

We are given two numbers and our task is to find out whether the given number is obtained by multiplying two other numbers such that all three numbers together constitute a 9-digit pandigital number. In other words, it can be said that we have to find out whether the given number is pandigital after combining it with two other numbers which result in the original number on multiplication. We can have many such cases where we will get multiple solutions for this problem, to get the best time complexity, we will simply print the first ever solution found and stop ... Read More

Minimum Adjacent Swaps Required to Sort the given Binary Array

Vaishnavi Tripathi
Updated on 11-Apr-2023 16:06:50

515 Views

There are different approaches, we can use to minimize the number of swaps required on adjacent elements to get a sorted array. The given array as the output only contains two types of elements i.e., 0 and 1. We will discuss two different approaches to solve the problem in which the first solution uses extra space to store the number of zeroes, while the second one uses only constant space. Problem Statement We are given an array which contains only two types of elements 0 & 1. Our aim is to find out how many minimum swaps on adjacent elements ... Read More

Bakery Algorithm in Process Synchronization

Manish Kumar Saini
Updated on 04-Apr-2023 16:05:33

2K+ Views

It is a prerequisite to understand the terms "process synchronization", "critical section", and "inter-process communication" before we proceed to discuss the Bakery Algorithm in Process Synchronization. What is Process Synchronization? In a multiprocessing system, the process synchronization is a method of coordinating execution of multiple processes so it is ensured that all the processes access shared resources in a controlled and predictable manner. The primary goal of process synchronization is to avoid the problem of race conditions in the system. Though, it also resolves many other issues related to synchronization in a concurrent system. Therefore, the process synchronization ensures that ... Read More

Trusted Systems in Network Security

Pranavnath
Updated on 28-Mar-2023 17:24:16

3K+ Views

The term “Trusted system” means that it provides the user with an assurance that no malicious or harmful software affects the computer system. Network Security plays a vital role in many organizations, to keep the data safe and secure from being attacked by cyberattacks or malware. Now Companies are using cloud storage, Wireless network, and remote application, so the challenges in protecting them are also increased. Here the Trusted systems provide Multi-layered security (MLS) for securing the networks. The trusted applications will not allow any changes in the policy. In this article, the models of network security to have trusted ... Read More

Transmission mode

Pranavnath
Updated on 28-Mar-2023 17:22:31

2K+ Views

Communication is defined as the transfer or sharing of data between any two individuals through a medium and the medium can be wired or wireless. In a computer network, the OSI (Open System Interconnection) model has seven layers for the communication networks. The First layer of OSI is the Physical layer that uses the Transmission mode for transferring the raw data to other devices using a physical medium. Transferring modes refer to the process of transferring data from one point to the other point or device over a particular network. The Channel between the two devices can be buses or ... Read More

Program to check the similarity of given two triangles

Simran Kumari
Updated on 23-Mar-2023 14:49:07

352 Views

In this problem, we will learn to check the similarity of two given triangles, which have many real-world use cases from the viewpoint of a programmer. To construct and manage 2D and 3D models of things, CAD systems are utilized, and one key function is the capability to compare two triangles. For instance, engineers working in design and construction may need to make that the foundational measurements of a building match the blueprint. Engineers can rapidly evaluate whether the angles and sides of the foundation game the layout by utilizing a CAD tool that has a built-in feature to check ... Read More

Program to calculate the Surface Area of a Triangular Prism

Simran Kumari
Updated on 23-Mar-2023 14:40:10

320 Views

Let us see how to write a program to calculate the Surface Area of a Triangular Prism. It might seem very basic to calculate the surface area of a triangular prism, but there are various areas where programmers may feel the need for it. Some of the common scenarios are listed below − 3D graphics and animation − While constructing 3D models, animators and game developers may need to compute the surface area of a triangular prism in order to correctly represent it in a virtual world. Engineers and architects may need to determine the surface area of ... Read More

Number of triangles in a plane if no more than two points are collinear

Simran Kumari
Updated on 23-Mar-2023 14:35:32

165 Views

Let us see how to calculate the number of triangles in a plane with n number of points given, with the constraint that not more than two points are collinear. Computing the number of triangles in a plane with no more than two collinear points is a typical problem in computational geometry, and it is used in computer graphics, image processing, and other areas of computer science. While creating a 2D image from a 3D scene in 3D graphics, for instance, the issue of counting triangles in a plane with no more than two points collinear can come up. The ... Read More

Different ways to represent N as the sum of K non-zero integers

Simran Kumari
Updated on 23-Mar-2023 14:31:37

575 Views

The problem “Different ways to represent N as the sum of K non-zero integers” has many real-world use cases. Cryptography − In cryptography, specific cryptographic methods are designed using the concept of encoding a number N as the sum of K non-zero integers. Representing an integer N as the sum of K non-zero integers might appear as a subproblem in different optimization issues in the context of optimization methods. Machine learning − In machine learning, feature vectors that depict the distribution of data points can be created by using the problem of representing an integer N as the sum of ... Read More

Advertisements