Advertisement
Guest User

Untitled

a guest
Mar 25th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.81 KB | None | 0 0
  1. #include <stdio.h>
  2. #include "tree.h"
  3.  
  4. int main() {
  5.     int max = 476625; // maximum number of ADD_NODE commands in 5MB file
  6.  
  7.     int treeSize = sizeof(Tree);
  8.     int listSize = sizeof(List);
  9.     int nodeSize = sizeof(Node);
  10.     int nodePointerSize = sizeof(Node*);
  11.  
  12.     printf("Size of structural types\n\n");
  13.     printf("struct Tree: %d\n", treeSize);
  14.     printf("struct List: %d\n", listSize);
  15.     printf("struct Node: %d\n", nodeSize);
  16.  
  17.     printf("\nSize of all instances of types above\n\n");
  18.     printf("%d Nodes: %d\n", max, max * nodeSize);
  19.     printf("%d Lists: %d\n", max, max * listSize);
  20.     printf("%d Sentinels (Nodes): %d\n", 2 * max, 2 * max * nodeSize);
  21.     printf("Array of %d Node pointers: %d\n", max, max * nodePointerSize);
  22.  
  23.     int all = max * (3 * nodeSize + listSize + nodePointerSize);
  24.  
  25.     printf("\nAll: %d\n", all);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement