Learn practical skills, build real-world projects, and advance your career
Updated 3 years ago
Binary Search Trees (BST), Traversals and Balancing in Python
helper notebook: Link
Problem
In this notebook, we'll focus on solving the following problem:
QUESTION 1: As a senior backend engineer at Jovian, you are tasked with developing a fast in-memory data structure to manage profile information (username, name and email) for 100 million users. It should allow the following operations to be performed efficiently:
- Insert the profile information for a new user.
- Find the profile information of a user, given their username
- Update the profile information of a user, given their usrname
- List all the users of the platform, sorted by username
You can assume that usernames are unique.
Since, we need to create a data structure which can store 100 million records and perform insertion, search, update and list operations efficiently.
The records to be stored are user information like name, username and email.
so, first of all, let's create a python class to represent this user information.
class User:
def __init__(self, name, username, email):
self.name = name
self.username = username
self.email = email