Hey guys I\'m trying to get started on my CS assignment (second year C paper). In this course we have created a Binary Search Tree ADT and also a Red Black Tree ADT. We have to combine them into one
I want to do the following, but \"Iterable[BASE]\" won\'t compile. What i开发者_如何学运维s the right way to do it, while keeping BASE an abstract type?
If I use the standard definition of an Abstract Data Type as a black box that provides some functions to manage a collection of data, a Linked List fits that description:
If you look at the Container ADT (abstract data type) as a black box, it provides two functions: 1. put(C, x)
What is the time complexity of the put(x) and get() functions for a Stack abstract data type that is implemented using a LinkedList?
Suppose I have a module that contains a type: module My where data L a = Nil | Cons a (L a) The module exports the concrete definition of My to allow for pattern matchi开发者_C百科ng etc.
I have a data type which carries a \'hidden\' (inferred) type and a concrete value. Now I try to implement a function which changes both of these but am unable to make it pass GHC.
Given two date types defined as follows: data Foo = Foo Bar String data Bar = Bar Foo String How can I make foo and bar s开发者_如何学Gouch that foo is Foo bar \"foo\" and bar is Bar foo \"bar\"?
My specific problem is actually not about the general translation of an OO interface to Haskell. This is just the best title I could come up with. Yet, I\'m sure that my problem originates from a stil
Nodes are useful for implementing ADTs, but is \"node\" itself an ADT? How does one implement \"node\"? Wikipedia uses a plain old struct with no methods in its (brief) articl开发者_C百科e on nodes. I