akosiraff

Download LinkedListStack and LinkedList_ADT_CPP

Aug 25th, 2015
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1.  
  2. Download: http://solutionzip.com/downloads/linkedliststack-and-linkedlist_adt_cpp/
  3. Part 1:
  4. Create a simple linked list program to create a class list containing
  5. class node {
  6. void *info;
  7. node *next;
  8. public:
  9. node (void *v) {info = v; next = 0; }
  10. void put_next (node *n) {next = n;}
  11. node *get_next ( ) {return next;}
  12. void *get_info ( ) {return info;}
  13. };
  14. Be able to initially fill the list. Provide functions to insert/append nodes and remove nodes from the linked list. Be able to display the contents of the list.
  15. Write a little driver program with at least 5 values passed in (so that 5 nodes are created) as you insert/append, delete and display data, showing the programs operation
  16. Part 2:
  17. Create a program that uses a derived class based on the list class you’ve created in the first program. This program will use a stack data type.
  18. class node {
  19. void *info;
  20. node *next;
  21. public:
  22. node (void *v) {info = v; next = 0; }
  23. void put_next (node *n) {next = n;}
  24. node *get_next ( ) {return next;}
  25. void *get_info ( ) {return info;}
  26. };
  27. class list {
  28. node *head;
  29. int node_num;
  30. public:
  31. list ( ) { node_num = 0; head = 0;}
  32. void remove (int);
  33. void insert (void *, int);
  34. void append (void * v) {insert (v, node_num + 1); }
  35. void *find (int);
  36. void display ( );
  37. };
  38. Write functions to push and pop the stack. Write a driver main program which gives 5 values (5 nodes created) that will push, pop and display data stored.
  39.  
  40. Download: http://solutionzip.com/downloads/linkedliststack-and-linkedlist_adt_cpp/
Add Comment
Please, Sign In to add comment