Write a program that inputs a line of text and uses a stack object to print the words of the line in reverse order. Write a program that creates a linked-list object of 10 characters, then creates a second list object containing a copy of the first list, but in reverse order. The program should calculate the sum of the elements and the floating-point average of the elements. Write a program that inserts 25 random integers from 0 to 100 in order into a linked-list object. Method merge of class ListMerge should receive references to each of the list objects to be merged and return a reference to the merged list object. Write a program that merges two ordered-list objects of integers into a single ordered-list object of integers. Class ListConcatenate should include a method concatenate that takes references to both list objects as arguments and concatenates the second list to the first list. Write a program that concatenates two linked-list objects of characters. Composition enables a class to reuse code by storing an instance of another class in a field.Public methods of a superclass can be accessed through a subclass to eliminate duplicate logic. Inheritance enables a subclass to reuse the functionality from a superclass.Classes allow us to instantiate as many data structure objects of a certain type (i.e., class) as we wish.A stack is a LIFO data structure that has a single reference to the top of the stack, where both insertion and deletion of nodes are performed. Nodes in a stack may be inserted only at the top of the stack and removed only from the top.Ī queue is a FIFO data structure that has references to both its head and its tail, so that nodes may be inserted at the tail and deleted from the head. It is possible to insert a node anywhere in a linked list and remove a node from anywhere in a linked list.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |