Skip to content

Instantly share code, notes, and snippets.

View shreezan123's full-sized avatar

Shrijan Aryal shreezan123

View GitHub Profile
package Driver;
import howard.edu.ood.hw2.collections.ArrayQueue;
public class Main_Queue {
public static void main(String args[]){
ArrayQueue myqueue = new ArrayQueue(10);
//to enqueue elements onto the stack
for (int i = 0; i<20;i++){
@shreezan123
shreezan123 / StackOperations.java
Created February 22, 2017 14:00
Stack implementation in Java
public class StackOperations{
int mystack[];
int global_size;
int counter = 0;
int newcounter = 0;
int extensionstack[];
public StackOperations(int size){
this.mystack = new int[size]; //create a stack of size as mentioned while creating object
#include <iostream>
#include <string>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
template<typename ItemType>
void Swap(ItemType& V1, ItemType& V2 )
{
@shreezan123
shreezan123 / arraypairsum
Created November 9, 2016 18:21
Find pairs in an integer array whose sum is equal to input parameter (bonus: do it in linear time)
def sumnums(arr,sum):
anslist = []
dict = {}
for each in arr:
if each not in dict:
dict[each] = 1
else:
dict[each] += 1
print(dict)
for each in dict: