This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| /* | |
| Note: I haven't tested the code completely but logic is correct and you can manipulate the code to correct minor bugs | |
| under Creative Common license | |
| */ | |
| #define REP(i, a, b) for (int i = a; i <= b; i++) | |
| #define FOR(i, n) for (int i = 0; i < n; i++) | |
| #define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| #define FOR(i, n) for (int i = 0; i < n; i++) | |
| unsigned int message = 0 ; | |
| unsigned int POLYNOMIAL = 0 ; | |
| unsigned int rem = 0 ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| #define FOR(i, n) for (int i = 0; i < n; i++) | |
| // IMPLEMENT PARITY CHECK | |
| // odd parity error | |
| int main ( ) | |
| { | |
| string s ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Distance Vector Routing in this program is implemented using Bellman Ford Algorithm:- | |
| */ | |
| #include<stdio.h> | |
| struct node | |
| { | |
| unsigned dist[20]; | |
| unsigned from[20]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| #define FOR(i, n) for (int i = 0; i < n; i++) | |
| // IMPLEMENT HAMMING CODE ERROR CORRRECTING | |
| int main ( ) | |
| { | |
| string s ; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| // IMPLEMENT BYTE STUFFING AND CHARACTER STUFFING | |
| // Bit STUFFING ADD ONE ZERO AFTER EVERY 5 CONSECTIVE ONES | |
| /* | |
| Byte stuffing can solvethe problem by reserving a third character to mark occurrences of special characters | |
| in the data.Use reserved characters to indicate the start and end of a frame. For instance, use the two-character | |
| sequence DLE STX (Data-Link Escape, Start of TeXt) to signal the beginning of a frame, and thesequence | |
| DLE ETX (End of TeXt) to flag the frame's end.Problem: What happens if the two-character sequence DLE |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| bool check( path , vertex , posn ) | |
| { | |
| for i = 1 to posn | |
| if path[ i ] == vertex // checking if this vertex has already occured in our path | |
| then return false // if yes then return false | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 4->2->1 | |
| void segregateEvenOdd(struct node *head_ref) | |
| { | |
| struct node* it = head_ref; | |
| struct node* prevofe = NULL ; | |
| struct node* evenh = NULL ; | |
| struct node* prev = NULL ; // Initially prev is null | |
| struct node* temp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <bits/stdc++.h> | |
| using namespace std; | |
| #define REP(i, a, b) for (int i = a; i <= b; i++) | |
| #define FOR(i, n) for (int i = 0; i < n; i++) | |
| #define foreach(it, ar) for ( typeof(ar.begin()) it = ar.begin(); it != ar.end(); it++ ) | |
| #define fill(ar, val) memset(ar, val, sizeof(ar)) | |
| #define PI 3.1415926535897932385 | |
| #define uint64 unsigned long long |
NewerOlder