AbstractDataTypes Flashcards
What is an abstract data type?
Defines the behavior of a data structure from point of a viewer.
What are generics?
Data structures sould work with any type, a class or interface can declare a type parameter, or a fake type, a placeholder.
Used in brackets MyClass<T></T>
returned as public t GetThing();
What is a stack interface?
Stores in reverse order.
LIFO – last in, first out.
Provides several operations – push, peek, pop, size.
What are queues and priority queues?
First in/first out. Priority queues assign priority, and the element w/ highest priority is removed first.
Has following methods:
enqueue - add an item to the end of the queue.
peek - return but do not remove the oldest item in the queue.
dequeue - remove and return the oldest item in the queue.
size - the number of elements currently in the queue.
What is a list?
A list is a popular data structure to store data in sequential order. For example, a list of students, a list of available rooms, a list of cities, and a list of books, etc. can be stored using lists. The common operations on a list are usually the following:
· Retrieve an element from this list.
· Insert a new element to this list.
· Delete an element from this list.
· Find how many elements are in this list.
· Find if an element is in this list.
· Find if this list is empty.
What are two ways to implement a list?
Arrays, linkedlist of nodes.