Homework Clinic

Science Clinic => Computer Science => Programming and Graphic Design => Topic started by: sammy on Aug 30, 2020

Title: What is an ADT (an Abstract Data Type) and why are they considered to be "abstract?"
Post by: sammy on Aug 30, 2020

Question 1

What common Exception(s) might arise when using an array?  What common Exception(s) might arise when using a linked list?

Question 2

What is an ADT (an Abstract Data Type) and why are they considered to be "abstract?"
Title: What is an ADT (an Abstract Data Type) and why are they considered to be "abstract?"
Post by: guyanai on Aug 30, 2020

Answer 1

In the array, an ArrayOutOfBoundsException or IndexOutOfBoundsException might arise if you use an array index that is either negative or larger than (or equal to) the size of the array.  In the linked list, a NullPointerException will arise if you attempt to access an item that is equal to null.  And, since the linked list uses dynamic memory, a OutOfMemoryException might also arise if you try to add to the list when additional memory is no longer available.

Answer 2

An ADT is a collection of data and the particular operations that are allowed on that data.  An ADT has a name, a domain of values, and a set of operations that can be performed.  An ADT is considered to be "abstract" because the operations you can perform are separated from the underlying implementation.  That is, the details on how an ADT stores its data and accomplishes its methods are separate from the concept that it embodies.