Remove Duplicates from Sorted Array and Return Length using Chash

Nizamuddin Siddiqui
Updated on 27-Aug-2021 12:27:29

272 Views

The array is already sorted, we can keep two pointers ii and jj, where ii is the slow-runner while jj is the fast-runner. As long as nums[i] = nums[j]nums[i]=nums[j], we increment jj to skip the duplicate.When we encounter nums[j] != nums[i] the duplicate run has ended so we must copy its value to nums[i + 1]nums[i+1]. ii is then incremented and we repeat the same process again until jj reaches the end of array.Time complexity − O(N)Example Live Demousing System; namespace ConsoleApplication{    public class Arrays{       public int RemoveDuplicatesFromSortedArrayAndReturnLength(int[] arr){          int index = 1; ... Read More

Sort 0, 1, 2 in an Array - Dutch National Flag Problem

Nizamuddin Siddiqui
Updated on 27-Aug-2021 12:25:16

280 Views

We need to take three-pointers, low, mid, high. We will use low and mid pointers at the start, and the high pointer will point at the end of the given array.If array [mid] =0, then swap array [mid] with array [low] and increment both pointers once.If array [mid] = 1, then no swapping is required. Increment mid pointer once.If array [mid] = 2, then we swap array [mid] with array [high] and decrement the high pointer once.Time complexity − O(N)Example Live Demousing System; namespace ConsoleApplication{    public class Arrays{       private void Swap(int[] arr, int pos1, int pos2){   ... Read More

Sort 0s and 1s in an Array without Extra Space using Chash

Nizamuddin Siddiqui
Updated on 27-Aug-2021 12:24:44

441 Views

Take two-pointers, low, high. We will use low pointers at the start, and the high pointer will point at the end of the given array.If array [low] =0, then no swapping requiredIf array [low] = 1, then swapping is required. Decrement high pointer once.Time complexity − O(N)Example Live Demousing System; namespace ConsoleApplication{    public class Arrays{       public void SwapZerosOnes(int[] arr){          int low = 0;          int high = arr.Length - 1;          while (low < high){             if (arr[low] == 1){     ... Read More

Rotate Array K Times Using Chash

Nizamuddin Siddiqui
Updated on 27-Aug-2021 12:22:28

1K+ Views

Given an array and number k, the problem states that we have to rotate the array k times.If the given number is 3 then the array must be rotated 3 times.Create a function reverse which takes the array, start and end as a parameter.In the 1st step call reverse method from 0 to array length.In the 2nd step call the reverse method from 0 to k-1.In the 3rd step call the reverse method from k+1 to array length.Example Live Demousing System; namespace ConsoleApplication{    public class Arrays{       public void ReverseArrayKTimes(int[] arr, int k){          Reverse(arr, ... Read More

Denial of Service (DoS) Attack and Its Types

Pranav Bhardwaj
Updated on 27-Aug-2021 06:31:23

8K+ Views

What is a Denial-of-Service Attack?A Denial-of-Service (DoS) attack is an attack on a computer network that limits, restricts, or stops authorized users from accessing system resources.DoS attacks work by flooding the target with traffic or sending it data that causes it to crash. It deprives genuine users of the service or resources they expect to receive.DoS assaults frequently target high-profile corporations such as banks, commerce, media companies, and government and trade organizations' web servers.Even through DoS assaults seldom result in the theft or loss of critical information or other assets, they can take a lot of time and money to ... Read More

TCP/IP in Computer Networking

Pranav Bhardwaj
Updated on 27-Aug-2021 06:29:45

14K+ Views

TCP stands for Transmission Control Protocol and IP stands for Internet Protocol. TCP/IP is a suite of protocols used for the communication of devices on a network. The network can be of any type: Internet or personal networks like the intranet, extranet, etc.The modern developments that we use on the Internet are only possible because of the TCP/IP suite. Although the name suggests only two protocols, it contains other protocols in it. Let us look at the functioning of this suite in detail.Working of TCP/IPIn simple terms, TCP takes care of how data is transferred in a network.It breaks down ... Read More

Ransomware Attack on the US Maritime Sector in 2019

Pranav Bhardwaj
Updated on 27-Aug-2021 06:28:26

143 Views

The United States military is considered to be one of the most sophisticated forces in the world. However, it was challenged and called into question by a 2019 attack on one of the United States' naval stations.Ryuk RansomwareThe US Coast Guard's Christmas 2019 celebrations were apparently ruined by a Ryuk Ransomware assault, which purportedly interrupted government agencies' activities for more than 33 hours. A risk management program was created in accordance with the security protocol, following the best practices outlined in the NIST Cybersecurity Framework (CSF) and NIST Special Publication 800-82.This is a form of ransomware assault that may have ... Read More

Design Issues in Data Link Layer

Pranav Bhardwaj
Updated on 27-Aug-2021 06:27:19

11K+ Views

Datalink is a layer in the Open System Interconnections. It is the second layer in between the physical layer and the network layer. It manages the connection between the two nodes. Data links integrate certain methods like error control, flow control, and associated link management functions.Some of the main functions of the data link layer include providing a straightforward service interface to the network layer, framing flow control and error recognition, and frame formatting.Types of Data Link LayersData Link layer is mainly of two types −Logical Link Control Sub-Layer (LLC)Media Access Control Sub-layer (MAC)Logical Link Control Sub-Layer (LLC)It gives logic for ... Read More

Difference Between Google Drive and HCL Connections

Pranav Bhardwaj
Updated on 27-Aug-2021 06:24:18

200 Views

We know that different companies have been trying to help people use cloud computing on the Internet in the past few years. As a newbie, it is not easy to choose from the different types of cloud services out there because most of the services are not free, and it might take a tremendous amount of time to try every service.Let us compare two major services: Google Drive and HCL Connections. Note that HCL Connections is not a cloud service.Google DriveGoogle Drive is a file hosting service provided by Google. It was launched on April 24, 2012. It allows users ... Read More

Difference Between Backblaze B2 and Jumpshare

Pranav Bhardwaj
Updated on 27-Aug-2021 06:23:06

161 Views

Backblaze B2Backblaze is a company that provides cloud storage and data backup services. It was founded in 2007 by Gleb Budman, Billy Ng, Nilay Patel, Brian Wilson, Tim Nufire, Damon Uyeda, and Jones.The firm's two primary products are B2 Cloud Storage and Computer Backup, which are aimed at the commercial and consumer sectors.In addition, Backblaze launched a new project, Backblaze B2 cloud storage, in September 2015. It is focused on software integration for many types of enterprises.Backblaze has four data centers, three situated in the United States and one in the European Union.The files are encrypted on the user's PC, ... Read More

Advertisements