CSCA48H3 Lecture Notes - Lecture 1: Init
Document Summary
Exceptions: class emptyqueueerror(exception): pass def dequeue(self: "queue") -> object: if self. isempty(): raise emptyqueueerror. An abstract data type specifies a set of operations (or methods) and the semantics of the operations, but it does not specify the implementation of the operations. It simplifies the task of specifying an algorithm if you can denote the operations you need without having to think at the same time about how the operations are performed. Since there are usually many ways to implement an adt, it might be useful to write an algorithm that can be used with any of the possible implementation. Well-known adts, such as the stack adt are often implemented in standard libraries so they can be written once and used by many programmers. The operations on adts provide a common high level language for specifying and talking about algorithms. An adt is defined by the operations that can be performed on it, which is called an interface.