This file contains 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
Ransack::Adapters::ActiveRecord::Base.class_eval('remove_method :search') |
This file contains 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
package dsa.stack; | |
import java.util.Stack; | |
/** | |
* An implementation of Queue using two Stacks | |
* @author Braga | |
*/ | |
public class QueueStack<T>{ |
This file contains 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
package dsa.stack; | |
public class TestQueue { | |
public static void main(String[] args) { | |
QueueStack<Integer> queueUsingStack = new QueueStack<Integer>(); | |
queueUsingStack.enQueue(1).enQueue(2).enQueue(3).enQueue(4).enQueue(5).enQueue(6); | |
System.out.println("Queue current size is : "+queueUsingStack.size()); | |
System.out.println(queueUsingStack.deQueue()); | |
System.out.println(queueUsingStack.deQueue()); | |
System.out.println(queueUsingStack.deQueue()); |
This file contains 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 <iostream> | |
#include <queue> | |
using namespace std; | |
struct node | |
{ | |
int data; | |
struct node* left; | |
struct node* right; |
This file contains 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
package dsa.tree; | |
public class Tree { | |
Node root; | |
public static void main(String args[]) { | |
Tree anyTree = new Tree(); | |
anyTree.root = new Node(3); | |
anyTree.root.left = new Node(2); | |
anyTree.root.right = new Node(5); |
This file contains 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
/* | |
ASSUMPTIONS: | |
All characters are case insensitive | |
ENHANCEMENTS: | |
Auto correction of word | |
Display all words in postorder | |
SAMPLE DATA: - ALGO, ALL, ALSO, ASSOC, TREE, TRIE | |
+--> [G] ---+--> [O] |
This file contains 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
int main() | |
{ | |
trie mytrie; | |
char *s[] = {"tree","trie","algo","assoc","all","also","ass"}; | |
for(int i=0;i<sizeof(s)/sizeof(*s);i++) | |
{ | |
mytrie.insert_word(s[i]); | |
} | |
mytrie.display(); |
This file contains 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
double angle(int h, int m) | |
{ | |
double hangle = 0.5D * (h*60 + m); | |
double mangle = 6*m; | |
angle = abs(hangle – mangle); | |
angle = min(angle, 360-angle); | |
return angle; | |
} |
This file contains 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
p->data = p->next->data; | |
t = p->next; | |
p->next = p->next->next; | |
delete t; |
This file contains 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
void * memcpy ( void * destination, const void * source, size_t num ); | |
void * memmove ( void * destination, const void * source, size_t num ); |
OlderNewer