SlideShare a Scribd company logo
Souvenir’s Booth
USING AUTO COMPLETE
By: Abhinav Garg (101303004) | Akshit Arora (101303012) | Chahak Gupta (101303041)
(Analysis and Design of Algorithms (UCS 501) Project)
Submitted To - Ms. Tarunpreet Bhatia
“ANY”
“XYZ”
Project Introduction
• Autocomplete, is a feature in which an application predicts the rest
of a word a user is typing. In graphical user interfaces, users can
press the tab key to accept a suggestion or the down arrow key to
accept one of several.
• It speeds up human-computer interactions when it correctly predicts
words being typed. It works best in domains with a limited number
of possible words.
• The project focuses on studying different approaches to generate
strings with the prefix entered by the user.
Objective
1. To optimize auto-completion of the word.
2. To optimize depth first search by improving the traversal of data
structure by special algorithm and analysis techniques.
3. To search word in trie.
4. Modify the default structure of trie and with certain tweaks
improve the overall time complexity.
5. We substantially increased the number of word in the Trie from 4
to 45000 words and it worked correctly.
Algorithm Techniques Used
1. For printing all possible words in a trie with given root:
Backtracking Traversal (similar to DFS)
2. For searching the prefix in trie: naïve algorithm used
3. For insertion of new words in trie: Recursion
Structure of Node used in the project
Pseudocode -1 (Trie, C++)
suggest(key, pos, * root){
if(root->ptrs[key[pos]] != NULL){
suggest(key,pos+1,root->ptrs[key[pos]])
else
printall(root)
SOUVENIR_BOOTH(file, key, len)
string word
node *root
open file("wordlist.txt")
while(end of file)
word<-getword_from_file
insertword(word,0,root)
close file
if(len<=0)
return -1
suggest(key,0,root)
if(found)
print “no words found”
return
Pseudocode – 1 (Trie, C++)
InsertWord(word,pos,*root) {
If word.length()=pos
root->Word <- word
return
if root-> ptrs[word[pos]] IS NULL
newnode <- new node
newnode->info <- word[pos]
root->ptrs[word[pos]] <- newnode
insertword(word,pos+1,root->ptrs[word[pos]])
else
insertword(word,pos+1,root->ptrs[word[pos]])
printall(* root){
for i<-0 to 255
if(root->ptrs[i]!=NULL){
printall (root->ptrs[i])
if(root->Word != "" AND (root->Word.length() = len AND
len!=-9999))
print root->Word
else if(root->Word != "" AND len = -9999)
Print root->Word
found <- 1
Results and Screenshots
Figure 1: Output when user doesn't know length Figure 2: Output when user inputs non-positive length
Figure 3: Output when
specified length matches
Results and Screenshots
Figure 4: The dictionary
Asymptotic Analysis (Space complexity)
In worst case analysis, the dictionary will consist of words with no
common prefix. At every level, 256 combinations will be possible
from each node. So this will result in a lot of memory usage.
Maximum number of nodes possible at level 1=256;
Maximum number of nodes possible at level 2=2562 …
Maximum number of nodes possible at level m=256m
Maximum total number of nodes in a trie with m as maximum length
of word will be:
256+2562+2563+2564+……………. 256m
= (256(256m+1 – 1) )/( 256-1)
= (256/255) (256m+1 – 1) = O(256m)
Asymptotic Analysis (Time Complexity)
1. The key determines trie’s depth.
2. Using trie, we can search / insert the single key in O(M) time.
Here, M is maximum string length.
3. In this project, we get the search result in O(key_length + ∑(L)),
where key_length is input given by user and ∑(L) is summation of
all the string lengths starting with prefix entered by user.
Souvenir's Booth - Algorithm Design and Analysis Project Presentation
Conclusions
1. Souvenir’s Booth problem of finding the desired solution was
solved.
2. Auto complete was successfully implemented using Trie.
3. Suggests words if words of desired length are not available.
4. DFS and Trie's implementation was understood.
Achievements
Autocomplete speeds up human-computer interactions when it correctly predicts words being typed.
It works best in domains with a limited number of possible words (such as in command line
interpreters), when some words are much more common (such as when addressing an e-mail), or
writing structured and predictable text (as in source code editors).
Can be used for:
1. Web browsers: filling similar fields
2. E-mail programs: auto fill email
3. Search engines: Based on search history
4. Word Processors: auto correct
5. IDEs: syntax correction and highlighting
6. Mobiles: Typing most commonly used words
References
Topcoder Tutorials: https://www.topcoder.com/community/data-
science/data-science-tutorials/using-tries/
Bhavin’s Blog (Directi): http://bhavin.directi.com/to-trie-or-not-to-
trie-a-comparison-of-efficient-data-structures/
Wikipedia – Autocomplete and Trie data structure articles
Geeks for Geeks: http://www.geeksforgeeks.org/trie-insert-and-
search/

More Related Content

PPT
Cryptography and Network Security William Stallings Lawrie Brown
PDF
Souvenir's Booth - Algorithm Design and Analysis Project Project Report
PPTX
Interrupts
PPTX
Lexical analyzer generator lex
PPTX
Interactive os
PPTX
heap Sort Algorithm
PPTX
Binary Search Tree in Data Structure
PPTX
bus and memory tranfer (computer organaization)
Cryptography and Network Security William Stallings Lawrie Brown
Souvenir's Booth - Algorithm Design and Analysis Project Project Report
Interrupts
Lexical analyzer generator lex
Interactive os
heap Sort Algorithm
Binary Search Tree in Data Structure
bus and memory tranfer (computer organaization)

What's hot (20)

PPT
Disk structure
PPTX
Clock and clock cycle in processor architecture
PDF
Decimal adder
PPTX
Multiplication & division instructions microprocessor 8086
PPTX
Disk Scheduling Algorithms
PPTX
DMA and DMA controller
PPT
DES (Data Encryption Standard) pressentation
PPTX
Dfs presentation
PPT
Introduction to Basic C programming 01
PPTX
Multiplication algorithm
PPTX
Direct memory access (dma)
PPTX
Command line arguments
PPTX
Timing and control circuit
PPT
Byte stream classes.49
PDF
Dynamic programming
PPT
Ct213 memory subsystem
PPTX
memory reference instruction
PPTX
Disk structure
PPT
Priority scheduling algorithms
Disk structure
Clock and clock cycle in processor architecture
Decimal adder
Multiplication & division instructions microprocessor 8086
Disk Scheduling Algorithms
DMA and DMA controller
DES (Data Encryption Standard) pressentation
Dfs presentation
Introduction to Basic C programming 01
Multiplication algorithm
Direct memory access (dma)
Command line arguments
Timing and control circuit
Byte stream classes.49
Dynamic programming
Ct213 memory subsystem
memory reference instruction
Disk structure
Priority scheduling algorithms
Ad

Similar to Souvenir's Booth - Algorithm Design and Analysis Project Presentation (20)

PDF
'Trie' Data Structure for Auto Search Complete
PPTX
Dictionary implementation using TRIE
PPTX
Trie Logic.pptx for data structures and algorithms
PDF
Trie Data Structure
PDF
Description of the project Purpose To implement a simple au.pdf
PPTX
Application of tries
PPTX
Trie Data Structure
PPTX
Tries data structures
PPT
4888009.pptnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
PPTX
Shishirppt
PPTX
PDF
An Evaluation and Overview of Indices Based on Arabic Documents
PDF
An Evaluation and Overview of Indices Based on Arabic Documents
PDF
An evaluation and overview of indices
PPTX
presentation on important DAG,TRIE,Hashing.pptx
PPTX
Top k string similarity search
PPTX
TRIES_data_structure
'Trie' Data Structure for Auto Search Complete
Dictionary implementation using TRIE
Trie Logic.pptx for data structures and algorithms
Trie Data Structure
Description of the project Purpose To implement a simple au.pdf
Application of tries
Trie Data Structure
Tries data structures
4888009.pptnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn
Shishirppt
An Evaluation and Overview of Indices Based on Arabic Documents
An Evaluation and Overview of Indices Based on Arabic Documents
An evaluation and overview of indices
presentation on important DAG,TRIE,Hashing.pptx
Top k string similarity search
TRIES_data_structure
Ad

More from Akshit Arora (17)

PPTX
Kalam innovation award
PDF
Cv akshitarora
PDF
Capstone Report - Industrial Attachment Program (IAP) Evaluation Portal
PPTX
Organizational behavior presentation - Origins of Intelligence
PPTX
Application of Management Tools: Total Quality Management Course
PPTX
A multilevel automatic thresholding method based on a genetic algorithm for a...
PDF
Industrial Attachment Program (IAP) Report
PPTX
G.D.P. Trends in India
PDF
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
PPTX
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
PDF
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
PDF
Developing Interactive Landslide Simulator
PDF
Developing Interactive Landslide Simulator (Poster)
PDF
Developing Interactive Landslide Simulator (Report)
DOCX
Emotional Regulation and Stress Burnout
PDF
Asynchronous processors Poster
PPTX
Asynchronous Processors - The Clock less Future
Kalam innovation award
Cv akshitarora
Capstone Report - Industrial Attachment Program (IAP) Evaluation Portal
Organizational behavior presentation - Origins of Intelligence
Application of Management Tools: Total Quality Management Course
A multilevel automatic thresholding method based on a genetic algorithm for a...
Industrial Attachment Program (IAP) Report
G.D.P. Trends in India
SRS for Ph.D. Student Portal (C.S.E.D., Thapar University)
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project PPT
Image Segmentation using Otsu's Method - Computer Graphics (UCS505) Project R...
Developing Interactive Landslide Simulator
Developing Interactive Landslide Simulator (Poster)
Developing Interactive Landslide Simulator (Report)
Emotional Regulation and Stress Burnout
Asynchronous processors Poster
Asynchronous Processors - The Clock less Future

Recently uploaded (20)

PPTX
OOP with Java - Java Introduction (Basics)
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
DOCX
573137875-Attendance-Management-System-original
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPT
Mechanical Engineering MATERIALS Selection
PPTX
web development for engineering and engineering
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
PPT on Performance Review to get promotions
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Digital Logic Computer Design lecture notes
OOP with Java - Java Introduction (Basics)
Operating System & Kernel Study Guide-1 - converted.pdf
R24 SURVEYING LAB MANUAL for civil enggi
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
573137875-Attendance-Management-System-original
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Mechanical Engineering MATERIALS Selection
web development for engineering and engineering
Model Code of Practice - Construction Work - 21102022 .pdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
bas. eng. economics group 4 presentation 1.pptx
PPT on Performance Review to get promotions
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Automation-in-Manufacturing-Chapter-Introduction.pdf
Digital Logic Computer Design lecture notes

Souvenir's Booth - Algorithm Design and Analysis Project Presentation

  • 1. Souvenir’s Booth USING AUTO COMPLETE By: Abhinav Garg (101303004) | Akshit Arora (101303012) | Chahak Gupta (101303041) (Analysis and Design of Algorithms (UCS 501) Project) Submitted To - Ms. Tarunpreet Bhatia
  • 3. Project Introduction • Autocomplete, is a feature in which an application predicts the rest of a word a user is typing. In graphical user interfaces, users can press the tab key to accept a suggestion or the down arrow key to accept one of several. • It speeds up human-computer interactions when it correctly predicts words being typed. It works best in domains with a limited number of possible words. • The project focuses on studying different approaches to generate strings with the prefix entered by the user.
  • 4. Objective 1. To optimize auto-completion of the word. 2. To optimize depth first search by improving the traversal of data structure by special algorithm and analysis techniques. 3. To search word in trie. 4. Modify the default structure of trie and with certain tweaks improve the overall time complexity. 5. We substantially increased the number of word in the Trie from 4 to 45000 words and it worked correctly.
  • 5. Algorithm Techniques Used 1. For printing all possible words in a trie with given root: Backtracking Traversal (similar to DFS) 2. For searching the prefix in trie: naïve algorithm used 3. For insertion of new words in trie: Recursion
  • 6. Structure of Node used in the project
  • 7. Pseudocode -1 (Trie, C++) suggest(key, pos, * root){ if(root->ptrs[key[pos]] != NULL){ suggest(key,pos+1,root->ptrs[key[pos]]) else printall(root) SOUVENIR_BOOTH(file, key, len) string word node *root open file("wordlist.txt") while(end of file) word<-getword_from_file insertword(word,0,root) close file if(len<=0) return -1 suggest(key,0,root) if(found) print “no words found” return
  • 8. Pseudocode – 1 (Trie, C++) InsertWord(word,pos,*root) { If word.length()=pos root->Word <- word return if root-> ptrs[word[pos]] IS NULL newnode <- new node newnode->info <- word[pos] root->ptrs[word[pos]] <- newnode insertword(word,pos+1,root->ptrs[word[pos]]) else insertword(word,pos+1,root->ptrs[word[pos]]) printall(* root){ for i<-0 to 255 if(root->ptrs[i]!=NULL){ printall (root->ptrs[i]) if(root->Word != "" AND (root->Word.length() = len AND len!=-9999)) print root->Word else if(root->Word != "" AND len = -9999) Print root->Word found <- 1
  • 9. Results and Screenshots Figure 1: Output when user doesn't know length Figure 2: Output when user inputs non-positive length Figure 3: Output when specified length matches
  • 10. Results and Screenshots Figure 4: The dictionary
  • 11. Asymptotic Analysis (Space complexity) In worst case analysis, the dictionary will consist of words with no common prefix. At every level, 256 combinations will be possible from each node. So this will result in a lot of memory usage. Maximum number of nodes possible at level 1=256; Maximum number of nodes possible at level 2=2562 … Maximum number of nodes possible at level m=256m Maximum total number of nodes in a trie with m as maximum length of word will be: 256+2562+2563+2564+……………. 256m = (256(256m+1 – 1) )/( 256-1) = (256/255) (256m+1 – 1) = O(256m)
  • 12. Asymptotic Analysis (Time Complexity) 1. The key determines trie’s depth. 2. Using trie, we can search / insert the single key in O(M) time. Here, M is maximum string length. 3. In this project, we get the search result in O(key_length + ∑(L)), where key_length is input given by user and ∑(L) is summation of all the string lengths starting with prefix entered by user.
  • 14. Conclusions 1. Souvenir’s Booth problem of finding the desired solution was solved. 2. Auto complete was successfully implemented using Trie. 3. Suggests words if words of desired length are not available. 4. DFS and Trie's implementation was understood.
  • 15. Achievements Autocomplete speeds up human-computer interactions when it correctly predicts words being typed. It works best in domains with a limited number of possible words (such as in command line interpreters), when some words are much more common (such as when addressing an e-mail), or writing structured and predictable text (as in source code editors). Can be used for: 1. Web browsers: filling similar fields 2. E-mail programs: auto fill email 3. Search engines: Based on search history 4. Word Processors: auto correct 5. IDEs: syntax correction and highlighting 6. Mobiles: Typing most commonly used words
  • 16. References Topcoder Tutorials: https://www.topcoder.com/community/data- science/data-science-tutorials/using-tries/ Bhavin’s Blog (Directi): http://bhavin.directi.com/to-trie-or-not-to- trie-a-comparison-of-efficient-data-structures/ Wikipedia – Autocomplete and Trie data structure articles Geeks for Geeks: http://www.geeksforgeeks.org/trie-insert-and- search/