buckeyekarun
BAN USER
Set is an interface. How did you create a new instance on this line -
Set<Integer>[] allSets = new Set[a.length];
import java.util.ArrayList;
public class Stack
{
private ArrayList<Integer> stack;
public Stack()
{
stack = new ArrayList<Integer>();
}
public int push (int value)
{
stack.add(value);
return stack.size() - 1;
}
public int pop ()
{
int value = stack.get(stack.size() - 1);
stack.remove(stack.size() - 1);
return value;
}
public int getMiddle ()
{
return stack.get(stack.size()/2);
}
public int deleteMiddle ()
{
int value = stack.get(stack.size()/2);
stack.remove(stack.size()/2);
return value;
}
}
For the sake of brevity, the middle element is the 3 when there are 6 elements in the ArrayList. i.e [0,1,2,3,4,5]
- buckeyekarun January 10, 2014
Repjaydkelvey, Accountant at Apkudo
I am 34 years old and live in Houston with my family. I am working as a Human resources consultant ...
Repsuejnagel, Virus Researcher at Email Customer Service
Hello, I am Sue . I am a chief information officer at Vernon. I am responsible for providing the global communications ...
Repjimmybdepuy, Front-end Software Engineer at Arista Networks
Hi, I am Jimmy from los Angeles. I am a painter. I have Knowledge of different types and shades of ...
Another difference apart from what @RV mentioned -
- buckeyekarun March 03, 20141) A hash function takes an input and provides a short unique representation of the input. Anyone who has access to the hash function can get the same output for the given input.
However, an encryption function needs a secret key to get the output.
2) The purpose of hashing is to get integrity of data. The purpose of encryption is to get confidentiality.