Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Algorithms Articles
Page 5 of 39
CSMA with Collision Avoidance (CSMA/CA)
Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) is a network protocol for carrier transmission that operates in the Medium Access Control (MAC) layer. In contrast to CSMA/CD (Carrier Sense Multiple Access/Collision Detection) that deals with collisions after their occurrence, CSMA/CA prevents collisions prior to their occurrence. CSMA/CA is primarily used in wireless networks where collision detection is difficult or impossible due to the hidden terminal problem and the inability to simultaneously transmit and receive on the same channel. How CSMA/CA Works The algorithm of CSMA/CA follows these steps: When a frame is ready, ...
Read MoreCSMA with Collision Detection (CSMA/CD
Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network protocol for carrier transmission that operates in the Medium Access Control (MAC) layer. It senses or listens whether the shared channel for transmission is busy or not, and defers transmissions until the channel is free. The collision detection technology detects collisions by sensing transmissions from other stations. On detection of a collision, the station stops transmitting, sends a jam signal, and then waits for a random time interval before retransmission. How CSMA/CD Works CSMA/CD Operation Process ...
Read MoreDifferences between Data paths.
A CPU has two main sections: the data section (data path) and the control section. The data path consists of registers, ALU, and interconnection buses that carry out the actual data processing. Data paths are classified into three types based on how instructions are executed − Single Cycle, Multiple Cycle, and Pipeline. Single Cycle Data Path In a single cycle data path, each instruction completes in exactly one clock cycle. The clock cycle must be long enough to accommodate the slowest instruction, which wastes time for simpler instructions. Multiple Cycle Data Path In a multiple cycle ...
Read MoreExplain difference between Strong Entity and Weak Entity
In database design, entities are classified as strong or weak based on their independence. A strong entity can exist on its own with a primary key, while a weak entity depends on a strong entity and cannot be uniquely identified without it. Strong Entity A strong entity is independent of any other entity in the schema. It always has a primary key that uniquely identifies each instance. In an ER diagram, a strong entity is represented by a single rectangle, and a relationship between two strong entities is shown as a single diamond. Weak Entity A ...
Read MoreDifference between JPEG and PNG
JPEG and PNG are two widely used image file formats. JPEG uses a lossy compression algorithm, which reduces file size by discarding some image data. PNG uses a lossless compression algorithm, preserving all original image data without any quality loss. JPEG (Joint Photographic Experts Group) JPEG is best suited for photographs and images with smooth color gradients. It achieves smaller file sizes by discarding image data that the human eye is less likely to notice. The compression level is adjustable − higher compression means smaller files but more quality loss. JPEG does not support transparency. PNG (Portable ...
Read MoreMatrix multiplication algorithm
In this section we will see how to multiply two matrices. The matrix multiplication can only be performed, if it satisfies this condition. Suppose two matrices are A and B, and their dimensions are A (m x n) and B (p x q) the resultant matrix can be found if and only if n = p. Then the order of the resultant matrix C will be (m x q).AlgorithmmatrixMultiply(A, B): Assume dimension of A is (m x n), dimension of B is (p x q) Begin if n is not same as p, then exit otherwise define C ...
Read MoreOperations on an Array in Data Structures
Here we will see some basic operations of array data structure. These operations are −TraverseInsertionDeletionSearchUpdateThe traverse is scanning all elements of an array. The insert operation is adding some elements at given position in an array, delete is deleting element from an array and update the respective positions of other elements after deleting. The searching is to find some element that is present in an array, and update is updating the value of element at given position. Let us see one C++ example code to get better idea.Example#include #include using namespace std; main(){ vector arr; //insert elements ...
Read MoreBinary Tree Traversals in Data Structures
In this section we will see different traversal algorithms to traverse keys present in binary search tree. These traversals are Inorder traversal, Preorder traversal, Postorder traversal and the level order traversal.Suppose we have one tree like this −The Inorder traversal sequence will be like − 5 8 10 15 16 20 23The Preorder traversal sequence will be like − 10 5 8 16 15 20 23The Postorder traversal sequence will be like − 8 5 15 23 20 16 10The Level-order traversal sequence will be like − 10, 5, 16, 8, 15, 20, 23AlgorithminorderTraverse(root): Begin if root is not ...
Read MoreLevel Order Tree Traversal in Data Structures
In this section we will see the level-order traversal technique for binary search tree.Suppose we have one tree like this −The traversal sequence will be like: 10, 5, 16, 8, 15, 20, 23AlgorithmlevelOrderTraverse(root): Begin define queue que to store nodes insert root into the que. while que is not empty, do item := item present at front position of queue print the value of item if left of the item is not null, then insert left of item into que end ...
Read MoreBernoulli Distribution in Data Structures
The Bernoulli Distribution is a discrete distribution having two possible outcomes labeled by x = 0 and x = 1. The x = 1 is success, and x = 0 is failure. Success occurs with probability p, and failure occurs with probability q as q = 1 – p. So$$P\lgroup x\rgroup=\begin{cases}1-p\:for & x = 0\p\:for & x = 0\end{cases}$$This can also be written as −$$P\lgroup x\rgroup=p^{n}\lgroup1-p\rgroup^{1-n}$$Example#include #include using namespace std; int main(){ const int nrolls=10000; default_random_engine generator; bernoulli_distribution distribution(0.7); int count=0; // count number of trues for (int i=0; i
Read More