Remove Spaces from a String Using String Stream in C++

Prateek Jangid
Updated on 10-Aug-2022 08:41:07

957 Views

As the given problem says, we need to remove spaces from the string using a string stream. As the name suggests, a string stream converts a string into a stream. It works similar to cin in C++. It associates a string object that can access the string buffer in which it is stored. string s =" a for apple, b for ball"; res = solve(s); With a string buffer, we will read each word one by one and then concatenate it into a new string which will be our answer. Note − The class string stream is available ... Read More

Remove Number from Array to Form Geometric Progression Using C++

Prateek Jangid
Updated on 10-Aug-2022 08:29:25

164 Views

We are given an array of elements. We need to find whether the elements in the array are in Geometric Progression (GP) or not after removing any 1 element from the array. We can run out the possibilities and with observations to figure out that the first element is fake, or the second element is fake, or these 2 elements will give the common ratio of the array. After the common ratio is found, we can iterate on the array to see if all elements follow that rule. 2 base conditions would be to check if the first and second ... Read More

Remove Minimum Elements from Either Side in C++

Prateek Jangid
Updated on 10-Aug-2022 08:27:13

441 Views

The problem involves removing elements from any side of a list of integers in such a way that 2*min is greater than max. vector arr = {250, 10, 11, 12, 19, 200}; res = solve(arr); We can use brute force approach. We can try all possible subarrays which satisfy and find the longest one in which 2*min > max condition holds. We can also use dynamic programming approach to try all possible subarray combinations that are overkill and not required. Example  (Using Vector ADT) Suppose we have an array such as “[250, 10, 11, 12, 19, 200]”. To get ... Read More

Difference Between Circuit Switching and Message Switching

Kiran Kumar Panigrahi
Updated on 10-Aug-2022 08:23:03

2K+ Views

Circuit switching and Message switching are both telecommunication techniques that are used to transfer data from a source to a destination with minimal loss in transmission.Circuit switching is a way of constructing a dedicated network in which two network nodes create a dedicated communications channel before connecting. In message switching, the source and destination nodes are not connected; the intermediate nodes are in charge of data transfer.Read through this article to find out more about Circuit switching and Message switching and how they are different from each other.What is Circuit Switching?In circuit switching, networks create dedicated transmission channels. While other ... Read More

Difference Between CDMA and LTE

Kiran Kumar Panigrahi
Updated on 10-Aug-2022 08:17:53

5K+ Views

Code Division Multiple Access (CDMA) is a protocol used for 2G and 3G communication. In CDMA, a channel carries all types of transmission simultaneously without division of bandwidth or time. Data from different stations is transmitted simultaneously using different code modulation.Long-Term Evolution (LTE) is a high-performance interface for cellular mobile communications. It supports high-speed networks and at present, it is the fastest network protocol for smartphones and mobile phones.Read through this article to find out more about CDMA and LTE and how they are different from each other.What is CDMA?CDMA uses a single channel to carry all signals at the ... Read More

Remove Duplicates from a Sorted Linked List Using Recursion

Prateek Jangid
Updated on 10-Aug-2022 07:53:32

576 Views

A linked list is a sequence of elements that are connected together. Each list have a head and series of nodes and each node has data of the current node and link to next node. The basic operations of a linked list are insertion, deletion, search and delete. Removing duplicates from a sorted linked list One way to remove nodes from is using recursion. The idea is to compare each node with its adjacent node and delete the duplicate one they are equal. Our recursive call will return us to the next node. So for the next element, we will ... Read More

Remove Characters from Numeric String to Make it Divisible by 8

Prateek Jangid
Updated on 10-Aug-2022 07:50:42

195 Views

Given a number in the form of a string, we need to find where to make it divisible by eight after deleting zero or more elements. In other words, we need to find whether there is a subsequence of the string, which is divisible by 8. Return the modified string or -1 if it is not possible. According to divisibility rules, any number whose last three digits are divisible by 8 is also divisible by 8. For example, 56992992 and 476360 are divisible by 8, but 2587788 is not. If the result is a whole number, then the original number ... Read More

Difference Between Bandwidth and Throughput

Kiran Kumar Panigrahi
Updated on 10-Aug-2022 07:48:23

3K+ Views

Bandwidth and Throughput are frequently used terms in telecommunications and sometimes we tend to use them as synonyms, but there's a subtle difference between these two terms.Bandwidth refers to the data capacity of a channel. It is defined as the total amount of data which can be transferred over a network in a specific period of time. Throughput, on the other hand, refers to the exact measurement of data transferred in a specific time period. It is also termed as "effective data rate" or "payload rate". Every network connection has a throughput, which explains how bits are transmitted across a ... Read More

Remove Brackets from Algebraic String Using C++

Prateek Jangid
Updated on 10-Aug-2022 07:47:23

631 Views

Given an algebraic string like p-(q-r)-s, we need to remove the brackets and convert this string to a string with the same mathematical result. So the string p-(q-r)-s is converted to p-q+r-s, giving us the same mathematical result. To achieve this, we can use a stack and keep track of whether or not we should flip the upcoming signs in the bracket expression. 0 mean + or no flip 1 mean - or flip So on every bracket opening, we will push either 0 or 1 depending on whether the signs in this bracket will flip or not. ... Read More

Difference Between AES and DES Ciphers

Kiran Kumar Panigrahi
Updated on 10-Aug-2022 07:46:07

17K+ Views

Both DES and AES are symmetric-key block ciphers that are used in encryption where just one key (the secret key) is utilized to encode and decode electronic data. The key must be exchanged between the organizations communicating using symmetric encryption so that it can be utilized in the decryption process.Go through this article to find out the features of AES and DES ciphers and how they differ from each other.What is DES Cipher?The Data Encryption Standard, often known as DES, is a symmetric key block cypher developed by IBM in 1977.Plaintext is divided into two halves in DES encryption, and ... Read More

Advertisements