When do you need large heap for Elasticsearch?

C++ writing into the heap "forward"?

  • This program is suppose to input 3 doubles and store them into heap memory. Then I have to basically reverse the heap so if I input. 50 51 52 at first it will look like this. 52 points to 51 points to 50. When I reverse it, it should read like this in the heap: 50 points to 51 points to 52. Right now I can get: 50 points to 52 points to 51. I dont know how to switch 52 and 51. here is my header file: #ifndef DOUBLE_NODE_H #define DOUBLE_NODE_H namespace Own { struct Double_node { Double_node *next; double datum; }; } #endif Here is my .cpp: #include "Double_node.h" #include <iostream> using Own::Double_node; // ----------------------------------------… // GLOBAL PARAMETERS // ----------------------------------------… const int no_temp = 3; const double temp_diff = 15.0; // ----------------------------------------… int main() { // Point to the list's head. Double_node *head = 0; Double_node *tail = 0; // Read and store several daily low temperatures. for (int i = no_temp; i > 0; --i) { double low_temp; std::cin >> low_temp; // Link the low temperature into the list. Double_node *const p = new Double_node; (*p).next = head; (*p).datum = low_temp; //THIS IS THE PART WHERE IT SHOULD SWITCH THE TWO, DO I NEED A WHILE LOOP? for (Double_node *a = p; (*a).next != 0; a = (*a).next){ double store; double store2; store = (*a).datum; store2 = (*head).datum; (*a).datum = store2; (*head).datum = store; } head = p; } // Print the daily high temperatures. for ( const Double_node *q = head; q != 0; q = (*q).next ) { const double high_temp = (*q).datum + temp_diff; std::cout << high_temp << " "; } std::cout << std::endl; return 0; }

  • Answer:

    Try using different parameters at a time, and. Use it for each values.

Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.