Posts

Showing posts from April, 2021

Search 2D Matrix in a better way

Image
  Below implement a C++ program that user fewer steps than binary search algorithm for search in 2-dimensional integer matrix(array).It can be used to search array like above figure. CODE #include <iostream> using namespace std; //I define 5*5 matrix..But by this algorithm you can perform other sizes also.But need to declare in the algorithm int const rows = 5;   //define matrix No.of Rows... int const columns = 5; //define matrix No.of Columns... //function of seaching elements.... void binarySearch(int matrix[5][5], int x, int start, int last, int counting, int k3, int steps[5][5], int k1, int k2, int rows) {     while (start <= last) //check to stop searching...     {         int mid = last - (last - start) / 2;  //find middle element         counting = counting + 1;   //counting steps...         if (matrix[k3][mid] == x)         {             steps[k1][k2] = counting;  //asign the counting to steps array...             k3 = rows;   //if element found then to stop main funt

Behavior of Average Queing Delay vs Traffic Intensity

Image
       Queuing delay is the waiting time of a packet to be transmitted in the buffer.But queuing delay cannot say exactly.It can vary from packet to packet.So this queuing delay based on below, Traffic arriving rate to the buffer,Transmission rate of the link, Nature of the arriving traffic(that mean arriving periodically or arriving bursts), Size of the buffer    La/R graph La-Average bit arriving rate R-Bits transmission rate (*here assume that the buffer is very big) When La/R>1      In this case, Arriving rate > Transmission rate, So then queue will tend to increase without bound, that mean average queuing delay will be infinity.Because there will be a congestion because of packets arriving to the buffer more faster rate than transmission out those. When La/R ≤ 1 In this case the average queuing delay affects on the nature of packets arriving, If packets arrive periodically-then each packet arrives at L/R seconds.In this each packet arrive to an empty queue so there will