2

PROBLEM OF THE DAY : 31/01/2024 | Insert and Search in a Trie

 5 months ago
source link: https://www.geeksforgeeks.org/videos/problem-of-the-day-31012024-insert-and-search-in-a-trie/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

PROBLEM OF THE DAY : 31/01/2024

February 01, 2024 |480 Views
PROBLEM OF THE DAY : 31/01/2024 | Insert and Search in a Trie
Problem of the Day, Data Structures and Algorithms, trie
 Save  Share   Like
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Karan Mashru We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Trie but also build up problem-solving skills.

In this problem, we have to complete the Insert and Search functions for a Trie Data Structure.

Insert: Accepts the Trie's root and a string, modifies the root in-place, and returns nothing.
Search: Takes the Trie's root and a string, returns true if the string is in the Trie, otherwise false.

Note: To test the correctness of your code, the code-judge will be inserting a list of N strings called into the Trie, and then will search for the string key in the Trie. The code-judge will generate 1 if the key is present in the Trie, else 0.

Example :

Input:
n = 8
list[] = {the, a, there, answer, any, by, bye, their}
key = the
Output: 1
Explanation: 
"the" is present in the given set of strings. 

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/trie-insert-and-search0651/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/9693b744-344e-42a7-a93a-223f80a7408a

Read More

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK