You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30-1Lines changed: 30 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,33 @@
4
4
5
5
2. Write a function that takes a BitSet and returns the number of steps needed to shift all `1` bits to the left (maintaining the same `length()` of the BitSet).
6
6
7
-
3. Write a function that takes a BitSet and returns the number of steps needed to shift all `1` bits to the right.
7
+
3. Write a function that takes a BitSet and returns the number of steps needed to shift all `1` bits to the right.
8
+
9
+
## Stack Microlab
10
+
11
+
A stack is a data structure that stores a list of elements. Each element is added with the `push(element)` method and the most recent element can be retreived with the `pop()` method. The `peek()` method returns the top element on the stack without removing it from the stack. The **last** element put **in** the stack is the **first** one to come **out** -- this is why it's called a **Last In First Out** (LIFO) data structure.
12
+
13
+
Create your own Stack for Strings called `StringStack` and implement these three methods.
14
+
15
+
**Part 2**:
16
+
17
+
Generalize your StringStack to a generic Stack implementation. It should include appropriate type parameters and allow storage of any object type.
18
+
19
+
*hint*: There may be another existing collection that is useful for implementing a stack.
20
+
21
+
## Listbuilder
22
+
23
+
Create a ListBuilder interface with one method: `buildList(Array a):List`
24
+
25
+
Implement the interface and its method with the following classes:
26
+
27
+
-`ArrayListBuilder` -- Creates an ArrayList from the given array
28
+
-`LinkedListBuilder` -- Creates a LinkedList from the given array
29
+
30
+
Part 2: Override `buildList` with `buildList(Collection c):List` to take any collection type and produce the corresponding List type to the implementing class (just like part one). You may want to look at the `Collection.toArray()` method for this.
31
+
32
+
33
+
## Iterator
34
+
35
+
Create an `Iterator` that produces the Fibonacci series; call it `FibonacciIterator`. The `hasNext()` method should always return true because the Fibonacci series is an infinite set.
0 commit comments