Advertisement
Guest User

Untitled

a guest
Jan 17th, 2019
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. struct LIFO
  6. {
  7. LIFO * next ;
  8. int value;
  9. };
  10.  
  11. struct FIFO
  12. {
  13. FIFO * next;
  14. int value;
  15. };
  16.  
  17.  
  18. int main()
  19. {
  20. LIFO *first;
  21. int k;
  22.  
  23. LIFO *ptr = first ;
  24. LIFO *head = NULL;
  25. FIFO *top = NULL; // TOP LIST HEAD przy stacku
  26.  
  27. while(ptr!=NULL)
  28. {
  29. if(ptr->value>k)
  30. {
  31. top -> next = ptr;
  32. top = ptr;
  33. top->next = NULL;
  34. }
  35. else
  36. {
  37. head -> next= ptr;
  38. head = ptr;
  39. head -> next = NULL;
  40. }
  41. ptr = ptr->next;
  42. }
  43.  
  44. LIFO *minimum = head;
  45. LIFO *iteruj = head;
  46.  
  47.  
  48.  
  49. while(it!=NULL)
  50. {
  51. if (minimum -> value < iteruj ->value)
  52. {
  53. minimum = iteruj;
  54. }
  55.  
  56. iteruj = iteruj->next;
  57. }
  58.  
  59. FIFO * maximum = top;
  60. FIFO * licz = top ->next;
  61.  
  62. while (licz !=NULL)
  63. {
  64. if(maximum ->value < licz ->value)
  65. {
  66. maximum = licz ;
  67. }
  68. licz = licz ->next;
  69. }
  70.  
  71.  
  72. return (head,miniumum , top,maximum);
  73. }
  74.  
  75. /*
  76. ASERCJA
  77.  
  78. ADR x Z -> ADR x ADR x ADR x ADR ( można to zapisać jako ADR^4 czy to byłby błąd ?)
  79.  
  80.  
  81.  
  82. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement