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
public class Stack { | |
int top; | |
int[] stackA; | |
int size; | |
public Stack(int size){ | |
stackA = new int[size]; | |
top = -1; | |
this.size=size; | |
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 test; | |
public class Queue { | |
int size; | |
int[] queueA; | |
int top; | |
int rear; | |
public Queue(int size){ |
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 test; | |
public class Link { | |
public static class LinkedList<E>{ | |
public class Node<E>{ | |
E elem; | |
Node<E> next,previous; | |
} | |
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
//Max Product of three item subseq | |
//output 6 8 9 | |
//Max Prod = 432 | |
#include<iostream> | |
using namespace std; | |
int Max(int i, int j) | |
{ |
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 test; | |
public class StringToInt { | |
public static int strToInt( String str ){ | |
int i = 0; | |
int num = 0; | |
boolean isNeg = false; |
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 test; | |
public class StringToInt { | |
public static String IntToString( int num ){ | |
int rem = 0; | |
int div = 0; | |
StringBuilder sb = new StringBuilder(); | |
while(num !=0){ | |
rem = num%10; |
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 test; | |
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.LinkedList; | |
import java.util.List; | |
import java.util.Queue; | |
public class LargeMultipleThree { | |
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 test; | |
import java.util.Stack; | |
public class InfixToPostfix { | |
//checks for the priority of an operator | |
public static int priority(char ch){ | |
switch(ch){ |
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 test; | |
import java.util.Stack; | |
public class EvaluatePostfix { | |
public static int solution(String postfix){ | |
Stack<Integer> stack = new Stack<Integer>(); | |
int sum = 0; |
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 test; | |
public class MergeSort { | |
private static void mergesort(int[] arr, int n) { | |
int mid; | |
int[] left; |
OlderNewer