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 <stdio.h> | |
| #define DO(n) for(int i = 0; i < n; i++) | |
| int main() | |
| { | |
| int arr[10]; | |
| DO(10) | |
| arr[i] = 2 * i; |
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 <stdio.h> | |
| #define to ; i <= | |
| #define DO(range) for(int i = range; i++) | |
| int main() | |
| { | |
| int arr[10]; | |
| DO(0 to 9) |
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 <stdio.h> | |
| #define FILL(arr,n,eq) for(int i = 0; i < n; i++) arr[i] = eq; | |
| #define to ; i <= | |
| #define DO(range) for(int i = range; i++) | |
| int main() | |
| { | |
| int myArray[30]; |
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 <stdio.h> | |
| typedef struct a | |
| { | |
| unsigned short q : 4; | |
| unsigned short w : 2; | |
| unsigned short e : 4; | |
| unsigned short r : 6; | |
| }A; |
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
| try | |
| { | |
| mainsock = dynamic_cast<whatever>; | |
| if(!mainsock) | |
| throw ERROR_CODE; | |
| } | |
| catch(int er_code) | |
| { | |
| } |
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 <termios.h> | |
| #include <stdlib.h> | |
| void RestoreKeyboardBlocking(struct termios *initial_settings) | |
| { | |
| tcsetattr(0, TCSANOW, initial_settings); | |
| } | |
| void SetKeyboardNonBlock(struct termios *initial_settings) | |
| { |
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
| public const float SCALE = 1.5; | |
| public double compStr(string a, string b) | |
| { | |
| return (double)lcSubString2(a, b)/ Math.Pow((a.Length > b.Length ? a.Length : b.Length), SCALE); | |
| } | |
| public int lcSubString2(string _a, string _b) | |
| { |
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
| #if 0 | |
| #!/bin/sh | |
| g++ compins.cpp -o compins | |
| ./compins | |
| exit | |
| #endif | |
| #include <iostream> | |
| using std::cout; |
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
| import java.io.InputStream; | |
| import java.util.Map; | |
| import java.util.PriorityQueue; | |
| import java.util.Scanner; | |
| public class HuffmanTree { | |
| private Map<Character, Integer> counts; | |
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
| func merge(arr []int, start, mid, end int) { | |
| var sorted = make([]int, (end - start) + 1) | |
| sortPos := 0 | |
| leftPos := start | |
| rightPos := mid + 1 | |
| for ;sortPos < len(sorted); { | |
| if !(leftPos > mid || rightPos > end) { | |
| if arr[leftPos] < arr[rightPos] { | |
| sorted[sortPos] = arr[leftPos] |
OlderNewer