The Integer-Set-With-Next-Excluded ADT is an ADT with the usual set operations
add
, remove
, contains
, and
size
, along with new operations count-intervals
,
which determines the minimum number of complete intervals the integers in a set
can be divided into,
and next-excluded
,
which, given an integer x
returns the smallest integer
greater than or equal to x
that is not
in the set.
isset.h
to implement
the Integer-Set-With-Next-Excluded ADT using some variant of a
balanced binary search tree. "Balanced" can mean "approximately balanced"
or "balanced enough often enough" as long as any sequence of
$k$ add
, remove
, contains
,
and/or next-excluded
operations starting on an empty set
takes total time $O(k \log k)$ for large enough $k$ (so the efficiency
requirement will be met if each operation takes time $O(\log n)$ in the
worst case or if each operation takes amortized time $O(\log n)$ where
$n$ is the number of integers currently in the set). The
size
and count-intervals
operations should take $\Theta(1)$ time.
The provided header file isset.h
and your implementation
file isset.c
must be the only files needed to use
your implementation of the ADT.
If the input is not as specified or testable preconditions to the ADT functions are violated then your program must behave gracefully – it must not crash or go into an infinite loop.
Your program and any program that uses your implementation
correctly must not produce any error messages when run with
valgrind --tool=memcheck --leak-check=yes -q
.
If you choose to implement a splay tree, you may cast away the
const
qualifier where necessary
to account for the logical-but-not-physical-const
-ness
of some of the isset
functions.
We reserve the right to deduct points from submissions for violations of the following guidelines.
#include
d regardless of what other files have
been #include
d -- if a declaration is required by
your header files, then #include
the appropriate
header file in your header file (or write a forward declaration in
your header) rather than relying on your #include
rs
to have already #include
d those header files before
they #include
yours.
const
should be declared as const
.
-Wall
and -pedantic
options.
/home/httpd/html/zoo/classes/cs223/f2017/Assignments/ISSet
:
isset
using an unbalanced binary search tree; can be used as a starting point for your efficient implementation)
isset
; do not change, and note that this application does not fully test all of the required functions)
Submit your isset.c
, the provided isset.h
,
isset_test.c
, and a makefile that produces an executable
called Test
from isset_test.c
.