Category Archives: File operation

Saving a binary search tree to a file

Describe an algorithm to save a Binary Search Tree (BST) to a file in terms of run-time and disk space complexity. You must be able to restore to the exact original BST using the saved format. Sponsored: https://www.wanderful.io has published … Continue reading

Posted in File operation, Recursive, Tree | Leave a comment

Serialization/Deserialization of a binary tree

Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called ‘serialization’ and reading back from the file to reconstruct the exact same binary tree is ‘deserialization’. Sponsored: https://www.wanderful.io has … Continue reading

Posted in File operation, Recursive, Tree | Leave a comment

Print the last k line.

Write a method to print the last K lines of an input file using C++. Sponsored: https://www.wanderful.io has published a chatbot, who can chat with you and help you find apartments in San Francisco and Bay area. Check it out: http://m.me/wanderful.io … Continue reading

Posted in File operation | Leave a comment