[ create a new paste ] login | about

olnrao

Name: Laxmi
Email:
Site/Blog:
Location:
Default language: C
Favorite languages: C, C++, C#, Ruby
About:

Saved pastes by olnrao:

C, pasted on Mar 26:
1
2
3
4
5
#include <stdio.h>
#include <string.h>

long set_bit(long bm, int i)
{
...
view (65 lines, 33 lines of output)
C, pasted on Mar 26:
1
2
3
4
5
// Input ==> Output
// 0ab ==> 0ab, 0aB, 0Ab, 0AB
// abc ==> abc, abC, aBc, aBC, Abc, AbC, ABc, ABC

#include <stdio.h>
...
view (84 lines, 14 lines of output)
C, pasted on Dec 11:
1
2
3
4
5
// Find First Non-Repeated/Unique Character in a string
// Assumptions:
// - English Alphabets only (A-Z, a-z)
// - Case Insensitive
// - Max String Length < MAX_INT (or INT_MAX)
...
view (92 lines, 12 lines of output)
C, pasted on Jan 25:
1
2
3
4
5
// Problem: Binary Tree - PreOrder Traversal to Tree Shape -
// - When each node can only be named 'N' or 'L'
// - A node named 'N' must have exactly two children (not less and not more)
// - A node named 'L' must have zero children (or leaf node)
// - Not a complete binary tree - Ex: NNLLL
...
view (194 lines, 42 lines of output)
C, pasted on Jan 2:
1
2
3
4
// Problem: Numbers stored in linked list - Operations - +, -, *
// Assumptions: Positive Numbers, Number1 > Number2 for subtraction, 
//              Decimal digits, etc.
//
...
view (417 lines, 5 lines of output)
C, pasted on Dec 13:
1
2
3
4
// Problem: Ants - Travel, Collision 
//

#include <stdio.h>
...
view (117 lines, 21 lines of output)
C, pasted on Dec 13:
1
2
3
4
// Find Paranthesis Patterns - 
// Ex: 3 - () () (), () (()), (()) (), ((())), (() ())
//
#include <stdio.h>
...
view (65 lines, 10 lines of output)
C, pasted on Dec 8:
1
2
3
4
5
// Linked List with Random Pointer - Duplicate and Reverse
// Assumption: No two random pointers are pointing to the same node (except if NULL)
//

#include <stdio.h>
...
view (242 lines, 4 lines of output)
C, pasted on Dec 6:
1
2
3
4
// Find Most Frequently Occurring Number in O(n) - 
// Algorithm works for n/2 + 1, but not for any less frequent number (ex: n/3)
//
#include <stdio.h>
...
view (167 lines, 31 lines of output)
C, pasted on Nov 30:
1
2
3
4
// Generate numbers such that digit[i] < digit[j] where i < j
//

#include <stdio.h>
...
view (41 lines, 12 lines of output)
C, pasted on Nov 26:
1
2
3
4
// SMS Problem (Multiple Key Press) - #-Break, 1 - NULL, 2 - ABC2, ...etc 
//

//#define DEBUG_PRINT
...
view (141 lines, 14 lines of output)
C, pasted on Nov 24:
1
2
3
4
// Implementation of - pow(double base, int index)
//

#define DEBUG_PRINT
...
view (72 lines, 23 lines of output)
C, pasted on Nov 22:
1
2
3
4
// Negative Array Subscripts - Ex: a[-1]
//

#include <stdio.h>
...
view (16 lines, 4 lines of output)
C, pasted on Nov 22:
1
2
3
4
//
// Code to find the next higher number of a given number with same digits
//
#include <stdio.h>
...
view (195 lines, 54 lines of output)
C, pasted on Nov 7:
1
2
3
4
5
#include <stdio.h>

#define SIZEOFARRAY(arr)  (sizeof((arr))/sizeof((arr)[0]))

struct Node
...
view (127 lines, 10 lines of output)
C, pasted on Nov 6:
1
2
3
4
5
#include <stdio.h>
 
double FindMedian(int n, int *a);
 
int main(int argc, char* args[])
...
view (119 lines, 31 lines of output)