Lab Test 1

Part 1 [Maximum marks: 30]

A binary tree is supplied in the data file against your name. Read the file, and create the tree in the standard pointer-based repreentation. Maintain links for left and right chlidren. Don't maintain parent links. In the first line of the file, the number of nodes is supplied. If this number is n, nodes in the tree are identified as 0,1,2,...,n - 1. For each node, its ID and the IDs of its two child nodes are supplied in the file (-1 indicates no child, that is, NULL). While creating the tree, you also need to identify the root of the tree (it is not the node with ID 0). Return a pointer to the root node. In all of the subsequent parts, this pointer should be passed as the tree, not the raw data from the file.

Hint: After you read n from the input file, allocate a dynamic array of n tree nodes. Then, read the input file, and create child connections. The unique node which is not the child of any other node is the root node. However, if you are more comfortable with the conventional recursive way of creating the binary tree, store the data from the file in some array(s).

Redirecting a file to your program

Part 2 [Maximum marks: 30]

Print all the leaves of the tree.

Part 3 [Maximum marks: 20]

Students with odd PC numbers: Determine the maximum level in the tree at which a leaf appears.

Students with even PC numbers: Determine the minimum level in the tree at which a leaf appears.

The root is assumed to be at level zero, its children at level 1, and so on.

Part 4 [Maximum marks: 20]

Students with odd PC numbers: Print all the leaf nodes at the maximum level.

Students with even PC numbers: Print all the leaf nodes at the minimum level.

Submission site

You must submit your C/C++ source file, and the output of your program on your input file given below.

Input and output files

  1. 07NA3014 Chandrakant Bharti [Output]

  2. 08CS3027 Shyam Kumar Murmu [Output]

  3. 08MA2024 Rachit Murarka [Output]

  4. 08ME1006 Suvodhoy Sinha [Output]

  5. 09CS1044 Putty Vikas [Output]

  6. 09CS1046 Mood Vamshi Krishna Naik [Output]

  7. 09CS3031 Balaga Prasanth [Output]

  8. 09CS3034 Rahul [Output]

  9. 09CY2007 Rajul [Output]

  10. 09EC1024 Arijit Layek [Output]

  11. 09EC3022 Amit Kumar [Output]

  12. 09IE1029 Prashant Kumar Singh [Output]

  13. 09ME1059 Siddharth S Bhandari [Output]

  14. 09ME3030 Prateek Anand [Output]

  15. 10CH10030 Pranjal Goswami [Output]

  16. 10CS10001 Aakaash Panigrahi [Output]

  17. 10CS10002 Aayush Sureka [Output]

  18. 10CS10003 Akhil Israni [Output]

  19. 10CS10004 Animesh Sinha [Output]

  20. 10CS10005 Anish Haldiya [Output]

  21. 10CS10006 Anjani Kumar [Output]

  22. 10CS10007 Ankit Khedia [Output]

  23. 10CS10008 Apoorv Raj [Output]

  24. 10CS10009 B Sai Krishna [Output]

  25. 10CS10010 Banavath Aditya Naik [Output]

  26. 10CS10011 Deepak Khaneja [Output]

  27. 10CS10012 E V V Devi Sandeep [Output]

  28. 10CS10013 Gadde Ravi Teja [Output]

  29. 10CS10014 Gokul Chand Meena [Output]

  30. 10CS10015 Jilla Vivek [Output]

  31. 10CS10016 K Sai Sreemukh [Output]

  32. 10CS10017 Kanwar Pal Dhande [Output]

  33. 10CS10018 Kaushik Kumar Mahato [Output]

  34. 10CS10019 Lava Kumar Bokam [Output]

  35. 10CS10020 Malay Pramanick [Output]

  36. 10CS10021 Mandeep Singh Gill [Output]

  37. 10CS10022 Manish Mittal [Output]

  38. 10CS10023 Milind Mandlik [Output]

  39. 10CS10024 Mohammad Salman [Output]

  40. 10CS10025 Nadeem Anjum [Output]

  41. 10CS10026 Naval Kishore Peepliwal [Output]

  42. 10CS10027 Navgeet Agrawal [Output]

  43. 10CS10028 Nerella Venkata Sravan Kishan [Output]

  44. 10CS10029 Nishant Dalmia [Output]

  45. 10CS10030 Padamata Mruthyunjaya Rao [Output]

  46. 10CS10031 Palash Goyal [Output]

  47. 10CS10032 Pilaka Sireesha [Output]

  48. 10CS10033 Ponkishore B [Output]

  49. 10CS10034 Potharaju Sri Vidya Pranavi [Output]

  50. 10CS10035 Ravella Chaitanya Sreenivas [Output]

  51. 10CS10036 Rohit Kumar [Output]

  52. 10CS10037 Ronak Kumar Heliwal [Output]

  53. 10CS10038 Sahil Sharma [Output]

  54. 10CS10039 Sandeep Kumar Sahu [Output]

  55. 10CS10040 Shabahat Shakeel [Output]

  56. 10CS10041 Shashwat Kumar [Output]

  57. 10CS10042 Shivangi Agarwal [Output]

  58. 10CS10043 Srikar Polipalli [Output]

  59. 10CS10044 Suhansanu Kumar [Output]

  60. 10CS10045 Sumit Kumar [Output]

  61. 10CS10046 Sumit Saurabh [Output]

  62. 10CS10047 Suraj Kumar [Output]

  63. 10CS10048 Sushovan Mandal [Output]

  64. 10CS10049 Swetha Tibrewal [Output]

  65. 10CS10050 Tadishetti Ramteja [Output]

  66. 10CS10051 Tauseef Nomani [Output]

  67. 10CS10052 Vadlamudi Jaya Krishna [Output]

  68. 10CS10053 Vemula Rohith [Output]

  69. 10CS10054 Vipul Jain [Output]

  70. 10CS10055 Vyas Yogarshi Paritosh [Output]

  71. 10CS10056 Yelam Anil Kumar [Output]

  72. 10CS10057 Abhishek Panigrahy [Output]

  73. 10CS10058 Pujari Rajkumar [Output]

  74. 10CS10059 Saurabh Shukla [Output]

  75. 10CS10060 M Dastagiri Reddy [Output]

  76. 10CS10061 Himanshu Tiwari [Output]

  77. 10CS30001 Aakash Goenka [Output]

  78. 10CS30002 Abhishek [Output]

  79. 10CS30003 Abhishek Gupta [Output]

  80. 10CS30004 Akash Amat [Output]

  81. 10CS30005 Akash Maurya [Output]

  82. 10CS30006 Akash Shah [Output]

  83. 10CS30007 Amit Kumar Pandey [Output]

  84. 10CS30008 Arunender Singhh [Output]

  85. 10CS30009 Ashish Vasava [Output]

  86. 10CS30010 Ashwani Attri [Output]

  87. 10CS30011 Bathulwar Akash [Output]

  88. 10CS30012 Bhadreswar Ghuku [Output]

  89. 10CS30013 Buha Rajan Govindbhai [Output]

  90. 10CS30014 Challamalla Venkata Charan Teja [Output]

  91. 10CS30015 Chitukuri Architha [Output]

  92. 10CS30016 Degwekar Anand Dhananjai [Output]

  93. 10CS30017 Devender [Output]

  94. 10CS30018 Dewesh Agrawal [Output]

  95. 10CS30019 Gurman Bhalla [Output]

  96. 10CS30020 Harmanpreet Singh [Output]

  97. 10CS30021 Imran [Output]

  98. 10CS30022 Jeldi Ratan Rahul [Output]

  99. 10CS30023 Kale Aditya Ashok [Output]

  100. 10CS30024 Khade Nilesh Gajanan [Output]

  101. 10CS30025 Komal Agrawal [Output]

  102. 10CS30026 Kontham Rajesh [Output]

  103. 10CS30027 Krishna Kant Sijariya [Output]

  104. 10CS30028 Mohit Sharma [Output]

  105. 10CS30029 Om Misra [Output]

  106. 10CS30031 Parantap Sharma [Output]

  107. 10CS30032 Pratapa Srihari Vijayendra [Output]

  108. 10CS30033 Rahul Dewangan [Output]

  109. 10CS30034 Ritwik Yadav [Output]

  110. 10CS30035 Rohan Jain [Output]

  111. 10CS30036 Saurabh Agarwal [Output]

  112. 10CS30037 Shambhu Prasad [Output]

  113. 10CS30038 Shubhang Verma [Output]

  114. 10CS30039 Siddharth Kumar [Output]

  115. 10CS30040 Akhil Saxena [Output]

  116. 10CS30041 Pyreddy Mary Arpita [Output]

  117. 10CS30042 Saurabh Hota [Output]

  118. 10CS30043 Aakash Anuj [Output]

  119. 10CS30044 Yetesh Chaudhary [Output]

  120. 10EC10008 Avinash Ruchandani [Output]

  121. 10EC10058 Tippa Veera Venkata Satish [Output]

  122. 10EC30013 Baheti Priyanka Sushil [Output]

  123. 10EC30031 Shreeja Subrata Datta [Output]

  124. 99FB1331 Foolan Barik [Output]

Submission site

Back | Home